From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2206 invoked by alias); 6 Mar 2012 10:26:47 -0000 Received: (qmail 2196 invoked by uid 22791); 6 Mar 2012 10:26:46 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Mar 2012 10:26:33 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/51255] Using -fwhole-program breaks code which puts values in .ctors or .init_array Date: Tue, 06 Mar 2012 10:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Keywords Last reconfirmed Component CC Ever Confirmed Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00503.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51255 Richard Guenther 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 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).