From patchwork Tue Jan 3 11:28:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 133997 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 9553BB6F98 for ; Tue, 3 Jan 2012 22:29:06 +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=1326194947; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:In-Reply-To:Message-ID:References:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=qtu0gV7FitGfC2EmqdOHcki3qSk=; b=IbFc3M1Cqx6fKAn RqHznwEbc2gFyIiCbZmatWYcUBy2ARVpMeT97+8lR1+0JrVwamFxWDbzMUnUWUpo xACyQuR9zIvlrhKUbhagz7lenWiUXlXkMv40qvrVqYt+5Lz0x26D8ycSjF9bhRqL 2mcshD4DD+Bkm+m3gK3GcuvNIWxg= 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:Date:From:To:Cc:Subject:In-Reply-To:Message-ID:References:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=f1Wexbl6L/FonZpFVuzDHqT8fmxO1oYvWmkASwRWlzgGes2faZ+ptkA7u69NND 0iyas4qyB0PyIIKdPSUYx41feb1r5VTO3v2RjQZp428yaWQw7w6W3AZNeXDX8xs7 FQ2PDk2SRsqvhb9y9JmWp5PmZFGYPnRfWsnae5TgPubz8=; Received: (qmail 26967 invoked by alias); 3 Jan 2012 11:29:03 -0000 Received: (qmail 26959 invoked by uid 22791); 3 Jan 2012 11:29:02 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jan 2012 11:28:49 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 92F6F8EE5B; Tue, 3 Jan 2012 12:28:48 +0100 (CET) Date: Tue, 3 Jan 2012 12:28:48 +0100 (CET) From: Richard Guenther To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix PR51650 In-Reply-To: <4F020898.3010907@redhat.com> Message-ID: References: <4F01C374.6040801@redhat.com> <4F020898.3010907@redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 On Mon, 2 Jan 2012, Jason Merrill wrote: > On 01/02/2012 10:49 AM, Richard Guenther wrote: > > For the idea creating the DIE at the point we process the limbo DIE > > yes. But would you consider doing that unconditional or only for LTO? > > Unconditional. Anything that already passed the assert should be unaffected > by the change. There is a change in case the context is a FUNCTION_DECL or a NAMESPACE_DECL and the DIE for it is not already present. Previously we'd add the DIE to comp_unit_die (), now we are going to create a DIE for the function/namespace (which sounds better anyway, or if that was not supposed to happen we should have asserted that). > > I can certainly give it a shot. Just to check, do you mean the > > following? > > Yes. Ok, I committed the following. [LTO] Bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC 2k6 LTO build tested. Richard. 2012-01-03 Richard Guenther PR debug/51650 * dwarf2out.c (dwarf2out_finish): Always create a DIE for the context of a limbo DIE when it does not already exist. * g++.dg/lto/pr51650-3_0.C: New testcase. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 182784) +++ gcc/dwarf2out.c (working copy) @@ -22501,15 +22501,8 @@ dwarf2out_finish (const char *filename) else if (TYPE_P (node->created_for)) context = TYPE_CONTEXT (node->created_for); - gcc_assert (context - && (TREE_CODE (context) == FUNCTION_DECL - || TREE_CODE (context) == NAMESPACE_DECL)); - - origin = lookup_decl_die (context); - if (origin) - add_child_die (origin, die); - else - add_child_die (comp_unit_die (), die); + origin = get_context_die (context); + add_child_die (origin, die); } } } Index: gcc/testsuite/g++.dg/lto/pr51650-3_0.C =================================================================== --- gcc/testsuite/g++.dg/lto/pr51650-3_0.C (revision 0) +++ gcc/testsuite/g++.dg/lto/pr51650-3_0.C (revision 0) @@ -0,0 +1,20 @@ +// { dg-lto-do link } +// { dg-lto-options { { -flto -g } } } + +struct T; +struct C +{ + typedef ::T T; + virtual void E(); + static T *m () + { + static T *d; + return d; + } +}; +int +fn () +{ + C::m (); +} +int main() {}