This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/51255] Using -fwhole-program breaks code which puts values in .ctors or .init_array
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Mar 2012 10:25:53 +0000
- Subject: [Bug middle-end/51255] Using -fwhole-program breaks code which puts values in .ctors or .init_array
- Auto-submitted: auto-generated
- References: <bug-51255-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51255
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |wrong-code
Last reconfirmed| |2012-03-06
Component|lto |middle-end
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Ever Confirmed|0 |1
Summary|Using -flto breaks code |Using -fwhole-program
|which puts values in .ctors |breaks code which puts
|or .init_array |values in .ctors or
| |.init_array
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-06 10:25:53 UTC ---
Reproducible with -O -fwhole-program as well. This is IPA references work
which does not recognize count as being written to which is because we
removed the .init/fini_array section contents.
If you mark the section contents with the 'used' attribute it works correctly.
Honza, can we apply some magic here? Thus, recognize special section names
or so? Or is this a user bug (with -fwhole-program)? Note that the linker
plugin gets this wrong as well (somehow).