[Bug middle-end/51255] Using -fwhole-program breaks code which puts values in .ctors or .init_array

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 19 15:52:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51255

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-19 15:35:28 UTC ---
I would incline to declare this an user error. GCC does not control the meaning
of all of the user specified sections and thus I would say that user is either
required to use constructor/destructor attributes or "used" attribute.

For sure we can add magic and make cgraph_finalize_function or so to drop an
attribute implicitly.

Note that constructor/destructor attributes are different from used
attribute+named section. We know how to optimize away ctors/dtors without side
effects etc. So it would be better to convert such code to an dedicated
attribute.

Honza



More information about the Gcc-bugs mailing list