misc gengtype micro-patch (computing fn in get_output_file_for_structure)

Laurynas Biveinis laurynas.biveinis@gmail.com
Mon Nov 8 04:28:00 GMT 2010


> The following patch seems to correct a bug in
> get_output_file_for_structure. Otherwise, could anyone explain why the
> original thing worked? I suspect it is it was never called with a
> TYPE_PARAM_STRUCT, or for some other reason I cannot understand.

I've investigated and it's almost true that it was never called with a
TYPE_PARAM_STRUCT. However I have introduced
write_splay_tree_allocator_def which calls it with TYPE_PARAM_STRUCT
only, which then tries to read location information through the wrong
member of the union and by chance finds a NULL there, resulting in
gtype-desc.c output file, which by chance is correct. Not the best
state of the things.

Thus your patch is, unfortunately, not OK, and the proper fix would be
- replace get_output_file_for_structure with
get_output_file_with_visibility(NULL) in
write_splay_tree_allocator_def;
- in get_output_file_for_structure put a gcc_assert that s is
UNION_OR_STRUCT_P only.

Would you be willing to do this?

Thanks,
-- 
Laurynas



More information about the Gcc-patches mailing list