From patchwork Sun Dec 12 15:04:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 75249 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 1B4FAB7088 for ; Mon, 13 Dec 2010 02:05:04 +1100 (EST) Received: (qmail 2183 invoked by alias); 12 Dec 2010 15:05:02 -0000 Received: (qmail 2135 invoked by uid 22791); 12 Dec 2010 15:05:01 -0000 X-SWARE-Spam-Status: No, hits=-5.5 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; Sun, 12 Dec 2010 15:04:56 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBCF4sIW023249 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 12 Dec 2010 10:04:54 -0500 Received: from adjoa.redhat.com ([10.3.113.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBCF4qkR025455; Sun, 12 Dec 2010 10:04:53 -0500 From: Dodji Seketeli To: Jason Merrill Cc: GCC Patches Subject: Re: Fix PR debug/45088 References: <4CED9B5F.1010900@redhat.com> <4CF7EB84.700@redhat.com> X-URL: http://www.redhat.com Date: Sun, 12 Dec 2010 16:04:51 +0100 In-Reply-To: <4CF7EB84.700@redhat.com> (Jason Merrill's message of "Thu, 02 Dec 2010 13:55:00 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes 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 Jason Merrill writes: [...] > What about just having gen_type_die_with_usage check is_redundant_typedef? Like the patch below? Bootrapped and tested on x86_64-unknown-linux-gnu against trunk. commit d9f6a81775a92638d2c50d8478b261dd71ee2442 Author: Dodji Seketeli Date: Thu Nov 11 23:42:51 2010 +0100 Fix PR debug/45088 gcc/ * dwarf2out.c (gen_type_die_with_usage): Don't try to generate a typedef DIE for an injected-class-name. Consider it as a class name instead. gcc/testsuite/ * g++.dg/debug/dwarf2/self-ref-1.C: New test. * g++.dg/debug/dwarf2/self-ref-2.C: Likewise. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index c985527..38e96a8 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -20260,7 +20260,8 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, /* If TYPE is a typedef type variant, let's generate debug info for the parent typedef which TYPE is a type of. */ - if (typedef_variant_p (type)) + if (typedef_variant_p (type) + && !is_redundant_typedef (TYPE_NAME (type))) { if (TREE_ASM_WRITTEN (type)) return; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C new file mode 100644 index 0000000..81bcb27 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/self-ref-1.C @@ -0,0 +1,28 @@ +// Origin: PR debug/45088 +// { dg-do compile } +// { dg-options "-g -dA" } +// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_pointer_type\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_byte_size\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type" 4 } } + +struct A +{ + virtual ~A(); +}; + +struct B : public A +{ + virtual ~B(){} +}; + +struct C : public B +{ + A* a1; +}; + +int +main() +{ + C c; + c.a1 = 0; + return 0; +} + diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C new file mode 100644 index 0000000..b1c5401 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/self-ref-2.C @@ -0,0 +1,29 @@ +// Origin: PR debug/45088 +// { dg-do compile } +// { dg-options "-g -dA" } +// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_pointer_type\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_byte_size\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type" 4 } } + +template +struct A +{ + virtual ~A(); +}; + +struct B : public A +{ + virtual ~B(){} +}; + +struct C : public B +{ + A* a1; +}; + +int +main() +{ + C c; + c.a1 = 0; + return 0; +} +