From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 547 invoked by alias); 25 Sep 2010 22:17:50 -0000 Received: (qmail 537 invoked by uid 22791); 25 Sep 2010 22:17:49 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID 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; Sat, 25 Sep 2010 22:17:43 +0000 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/45791] Missed devirtualization X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization 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: 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 Date: Sun, 26 Sep 2010 06:02:00 -0000 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: 2010-09/txt/msg02808.txt.bz2 Message-ID: <20100926060200.aRbf4mATTgMIydrXRsbuCA2o0k8iF4UbjyPiECWYedk@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45791 --- Comment #5 from Jan Hubicka 2010-09-25 22:17:41 UTC --- Another testcase where we devirtualize via folding is: // { dg-do assemble } // { dg-options "-g -O2" } // Copyright (C) 1999 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 21 Nov 1999 // This causes assember relocation errors struct X { virtual ~X () {} }; struct Y { Y (){}; }; void foo () { X *x = new X; x->~X (); Y ys[2]; } compiled with -O2 we get x_3 = operator new (8); # DEBUG this => x_3 x_3->_vptr.X = &_ZTV1X[2]; # DEBUG x => x_3 D.2142_7 = (int (*__vtbl_ptr_type) (void)) __comp_dtor ; OBJ_TYPE_REF(D.2142_7;x_3->0) (x_3); that gets folded only in ccp3. We need FRE to fold: x_3->_vptr.X = &_ZTV1X[2]; # DEBUG x => x_3 D.2141_6 = &_ZTV1X[2]; D.2142_7 = *D.2141_6; OBJ_TYPE_REF(D.2142_7;x_3->0) (x_3); into x_3 = operator new (8); # DEBUG this => x_3 x_3->_vptr.X = &_ZTV1X[2]; # DEBUG x => x_3 D.2141_6 = x_3->_vptr.X; D.2142_7 = *D.2141_6; OBJ_TYPE_REF(D.2142_7;x_3->0) (x_3);