From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21963 invoked by alias); 22 Sep 2011 14:21:02 -0000 Received: (qmail 21936 invoked by uid 22791); 22 Sep 2011 14:21:01 -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; Thu, 22 Sep 2011 14:20:47 +0000 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/50430] Constructors of static external vars are throwed away leading to missed optimizations (and ipa-cp ICE). Date: Thu, 22 Sep 2011 14:44: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: hubicka at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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-09/txt/msg01536.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50430 --- Comment #3 from Jan Hubicka 2011-09-22 14:20:07 UTC --- Created attachment 25340 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25340 reduced testcase This is somewhat reduced testcase. The problem can be a bit illustrated on C. We have something like extern vtable[]={vtable2} where vtable2 sits in other unit and is static. We however know the constructor and it is extern static vtable2[]={function_ptr}; now we can fold vtable[0] to the external vtable2 that we can not reffer in code, but still can fold references into it into function_ptr. now with LTO we decide to not stream vtable initializer and replace it by error_mark losing the knowledge. This is an regression to 4.6 even though it is not too important one.