From patchwork Wed Jan 25 16:29:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 137795 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 978CCB6F65 for ; Thu, 26 Jan 2012 03:30:39 +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=1328113839; h=Comment: DomainKey-Signature:Received: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=MTSVthP aiQELbk32+LFWJoCc9to=; b=UHQ0jpfCwblccYXjUoO2s0+8Af1rW14ICX3G2WG D5PIs9fstUXVp64i1fPGC2rVpKsdan4Blf/mtXtq7uak8Q45wQ0l2YqDjm3fsyuO CjKOf9fLxc4GKOQlfWKCIP/PbVzO3OlvbQVnqKZXl4T5QHyz//YJ/Vy+ynY0g2RF eRfI= 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: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=xREDK14jAclqnl6evAHQKcbS1mLU+P8iyAoShILzZmPEJk6k9wDu7PKas6YTkR s1wQaGhBqM5b1R7F5o0qbeQXa4Oyd8ler/P7eSk/RLMiT0UJpc27PzgyKORAm+M4 amxQyN2tmZ6ggeg1x0o2wPfqq9Uovjq54NylHOL2ayLiQ=; Received: (qmail 19350 invoked by alias); 25 Jan 2012 16:30:26 -0000 Received: (qmail 19323 invoked by uid 22791); 25 Jan 2012 16:30:22 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_FN, TW_TM, 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; Wed, 25 Jan 2012 16:30:08 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0PGU2KO015056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 Jan 2012 11:30:07 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0PGU1Ie006955; Wed, 25 Jan 2012 11:30:01 -0500 Received: from [0.0.0.0] (ovpn-113-135.phx2.redhat.com [10.3.113.135]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q0PGTwRr007975; Wed, 25 Jan 2012 11:30:00 -0500 Message-ID: <4F202E06.2080202@redhat.com> Date: Wed, 25 Jan 2012 11:29:58 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: gcc-patches List , Richard Guenther Subject: RFA: tree.c PATCH for c++/51992 (TARGET_EXPR in LTO stream) 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 The problem here turns out to be that when free_lang_data_in_cgraph tries to find all the decls and types in a function, it doesn't catch a type that only appears in the fntype of a GIMPLE_CALL. This patch fixes the bug; is there a better way to handle it? Tested x86_64-pc-linux-gnu, OK for trunk? commit 9febd1e3a2af987ecd1a62417b8948f679550254 Author: Jason Merrill Date: Wed Jan 25 11:14:30 2012 -0500 PR c++/51992 * tree.c (find_decls_types_in_node): Walk gimple_call_fntype. diff --git a/gcc/testsuite/g++.dg/lto/pr51992_0.C b/gcc/testsuite/g++.dg/lto/pr51992_0.C new file mode 100644 index 0000000..d178f9b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr51992_0.C @@ -0,0 +1,53 @@ +// PR c++/51992 +// { dg-lto-do assemble } + +template +class QFlags +{ + int i; + inline QFlags(Enum f) : i(f) {} +}; +class QString {}; +class KComponentData; +class KConfig +{ +public: + enum OpenFlag { + IncludeGlobals = 0x01, + CascadeConfig = 0x02, + FullConfig = IncludeGlobals|CascadeConfig + }; + typedef QFlags OpenFlags; +}; +template +class KSharedPtr {}; +class KSharedConfig : public KConfig +{ +public: + typedef KSharedPtr Ptr; + static KSharedConfig::Ptr openConfig(const QString& fileName = QString(), + OpenFlags mode = FullConfig, + const char *resourceType = "config"); + static KSharedConfig::Ptr openConfig(const KComponentData &componentData, + const QString &fileName = QString(), + OpenFlags mode = FullConfig, + const char *resourceType = "config"); +}; +typedef KSharedConfig::Ptr KSharedConfigPtr; +namespace KGlobal +{ + KComponentData &mainComponent(); +}; +KSharedConfigPtr KSharedConfig::openConfig(const QString& fileName, + OpenFlags flags, + const char *resType) +{ + return openConfig(KGlobal::mainComponent(), fileName, flags, resType); +} +KSharedConfigPtr KSharedConfig::openConfig(const KComponentData &componentData, + const QString& fileName, + OpenFlags flags, + const char *resType) +{ + return KSharedConfigPtr(); +} diff --git a/gcc/tree.c b/gcc/tree.c index ec78616..34bcb39 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5037,6 +5037,9 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) { gimple stmt = gsi_stmt (si); + if (is_gimple_call (stmt)) + find_decls_types (gimple_call_fntype (stmt), fld); + for (i = 0; i < gimple_num_ops (stmt); i++) { tree arg = gimple_op (stmt, i);