From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20322 invoked by alias); 6 Dec 2011 11:35:25 -0000 Received: (qmail 20151 invoked by uid 22791); 6 Dec 2011 11:35:24 -0000 X-SWARE-Spam-Status: No, hits=-2.9 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 Dec 2011 11:35:11 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/50601] [4.7 Regression] New LTO failures Date: Tue, 06 Dec 2011 11:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: 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: 2011-12/txt/msg00556.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50601 --- Comment #6 from Richard Guenther 2011-12-06 11:34:41 UTC --- Because the decl isn't considered decl_address_invariant_p () - of course, it is neither TREE_STATIC nor DECL_EXTERNAL ... It _is_ both TREE_PUBLIC and TREE_STATIC when created by the C++ frontend (and during compile stage). We get 2 cp_lto_20100302_0.o 4 164 6cc97232062f75e0 PREVAILING_DEF_IRONLY _Z1fPU8__vectorf 177 6cc97232062f75e0 PREVAILING_DEF_IRONLY _Z1fPDv4_f 180 6cc97232062f75e0 PREVAILING_DEF_IRONLY _ZN1AIDv4_fE1tE 182 6cc97232062f75e0 PREVAILING_DEF_IRONLY _ZN1AIU8__vectorfE1tE cp_lto_20100302_1.o 3 164 5d25700523736b18 PREVAILING_DEF main 168 5d25700523736b18 RESOLVED_IR _Z1fPDv4_f 179 5d25700523736b18 RESOLVED_IR _ZN1AIDv4_fE1tE which is then mangled via cgraph_make_decl_local during the IPA function and variable visibility pass. This removes the TREE_PUBLIC flag, the TREE_STATIC flag remains at WPA stage. Note that the parent, non-alias decl stays TREE_PUBLIC. The no longer TREE_PUBLIC alias is then mangled at LTRANS stage, and the TREE_STATIC flag is cleared in: input_varpool_node (file_data=0x7ffff5b61000, ib=0x19ec4f0) at /space/rguenther/src/svn/trunk/gcc/lto-cgraph.c:1083 1083 if (node->finalized) (gdb) l 1078 if (node->in_other_partition) 1079 { 1080 DECL_EXTERNAL (node->decl) = 1; 1081 TREE_STATIC (node->decl) = 0; 1082 } but DECL_EXTERNAL is in turn cleared again by assemble_alias (decl=0x7ffff5a2c140, target=0x7ffff5b5af00) at /space/rguenther/src/svn/trunk/gcc/varasm.c:5850 5850 if (TREE_CODE (decl) == FUNCTION_DECL) (gdb) l 5845 note that the symbol is in fact locally defined. */ 5846 if (! is_weakref) 5847 DECL_EXTERNAL (decl) = 0; that, of course, looks bogus in the light of LTO partitioning. Doing /* A quirk of the initial implementation of aliases required that the user add "extern" to all of them. Which is silly, but now historical. Do note that the symbol is in fact locally defined. */ if (! is_weakref && (TREE_CODE (decl) == FUNCTION_DECL || !varpool_node (decl)->in_other_partition)) DECL_EXTERNAL (decl) = 0; instead "fixes" this bug.