From patchwork Thu Mar 15 21:26:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 147094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id DF510B6EE6 for ; Fri, 16 Mar 2012 08:27:07 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1332451628; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=LPwlaGu IUerhKlvhQL50jXJPtcg=; b=RyiwDRl0TeUDrs0lWBPmK20/GKQwqa53fdIY1q7 kM9Eo3dLipSyfmbiZyUd7furaTXljkK1zHLPxxuH2WMxWwTmEB1qD1DEWCyqqKNx RCXjFeQLPNRyE5Ou1VveUDKNu5aD9Cb37teP8R6Czti8kHZZDlPgoPTKChT6jX0K j71o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ZUaH5NHgV8dbOdXo3PBcBFlZVKUd1xBiLbabRUR+WxxY/MoYUtMPOXoc7Zt1eL kZ75bRdI4V9mp4+L9DhcuY4oEPdbUUYNqxFjdw/ZD97hK99Vswbx2K98d5fUu7cN fPclynjndU2oHfoFSLqQ19V1D/Y+dfJxE4TYYplCsE/UA=; Received: (qmail 8890 invoked by alias); 15 Mar 2012 21:27:04 -0000 Received: (qmail 8880 invoked by uid 22791); 15 Mar 2012 21:27:03 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Mar 2012 21:26:44 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2FLQiQO001736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Mar 2012 17:26:44 -0400 Received: from [10.3.113.11] ([10.3.113.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2FLQhZA003512 for ; Thu, 15 Mar 2012 17:26:44 -0400 Message-ID: <4F625E93.9080100@redhat.com> Date: Thu, 15 Mar 2012 17:26:43 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/52582 (ICE with devirtualization on PPC) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org jakub and richi analyzed this bug; normally we set DECL_EXTERNAL on all functions with vague linkage, but we were failing to do so for the synthesized destructor, which caused problems with devirtualization. Fixed thus. Jakub tested the patch. Applying to trunk; will apply to 4.7 branch after 4.7.0. commit a5e3b73aaee13ed672641faee53989785cffed83 Author: Jason Merrill Date: Wed Mar 14 14:24:22 2012 -0400 PR c++/52582 * method.c (implicitly_declare_fn): Set DECL_EXTERNAL. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 0718916..0d4793e 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1593,6 +1593,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) DECL_DELETED_FN (fn) = deleted_p; DECL_DECLARED_CONSTEXPR_P (fn) = constexpr_p; } + DECL_EXTERNAL (fn) = true; DECL_NOT_REALLY_EXTERN (fn) = 1; DECL_DECLARED_INLINE_P (fn) = 1; gcc_assert (!TREE_USED (fn)); diff --git a/gcc/testsuite/g++.dg/torture/pr52582.C b/gcc/testsuite/g++.dg/torture/pr52582.C new file mode 100644 index 0000000..1b93fc4 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr52582.C @@ -0,0 +1,23 @@ +// PR c++/52582 + +inline void *operator new (__SIZE_TYPE__, void *p) throw () +{ + return p; +} +struct B +{ + virtual ~B (); + B (); +}; +struct A : B +{ + A () : B () {} + virtual void bar (); +}; +void +foo () +{ + char a[64]; + B *b = new (&a) A (); + b->~B (); +}