From patchwork Mon Jan 24 15:53:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 80190 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 5737A1007D1 for ; Tue, 25 Jan 2011 02:53:52 +1100 (EST) Received: (qmail 26148 invoked by alias); 24 Jan 2011 15:53:50 -0000 Received: (qmail 26132 invoked by uid 22791); 24 Jan 2011 15:53:48 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_GD, TW_VT, 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; Mon, 24 Jan 2011 15:53:43 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OFrf8m018648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jan 2011 10:53:41 -0500 Received: from adjoa.redhat.com (ovpn-113-80.phx2.redhat.com [10.3.113.80]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0OFrcdS031844; Mon, 24 Jan 2011 10:53:40 -0500 From: Dodji Seketeli To: Jason Merrill Cc: GCC Patches Subject: Re: Fix PR debug/47361 References: <4D39C3C8.4010602@redhat.com> X-URL: http://www.redhat.com Date: Mon, 24 Jan 2011 16:53:38 +0100 In-Reply-To: (Dodji Seketeli's message of "Mon, 24 Jan 2011 14:54:10 +0100") 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 Dodji Seketeli writes: > Jason Merrill writes: > >> This change is OK, but I don't think we want decltype(nullptr) to go >> into a comdat CU, so let's test for it in is_comdat_die as well. > > Yes. I have therefore tested the patch below on x86_64-unknown-linux-gnu > against trunk. Jakub pointed out on IRC that I should test this with -gdwarf4 as well since that flag makes the compiler take another path to eliminate type DIE dups. So I have added a test with that flag. Tested likewise. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2309297..44a3768 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9618,6 +9618,7 @@ is_type_die (dw_die_ref die) case DW_TAG_packed_type: case DW_TAG_volatile_type: case DW_TAG_typedef: + case DW_TAG_unspecified_type: return 1; default: return 0; @@ -9635,9 +9636,11 @@ is_comdat_die (dw_die_ref c) /* I think we want to leave base types and __vtbl_ptr_type in the main CU, as we do for stabs. The advantage is a greater likelihood of sharing between objects that don't include headers in the same order (and therefore would - put the base types in a different comdat). jason 8/28/00 */ + put the base types in a different comdat). jason 8/28/00 + We don't put DW_TAG_unspecified_type in comdat sections either. */ - if (c->die_tag == DW_TAG_base_type) + if (c->die_tag == DW_TAG_base_type + || c->die_tag == DW_TAG_unspecified_type) return 0; if (c->die_tag == DW_TAG_pointer_type diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C new file mode 100644 index 0000000..54f597e --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C @@ -0,0 +1,11 @@ +// Origin PR debug/47361 +// { dg-options "-g -std=gnu++0x -feliminate-dwarf2-dups" } + +typedef decltype (nullptr) nullptr_t; + +struct A +{ + A (nullptr_t = 0); +}; + +A a; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-2.C new file mode 100644 index 0000000..f6d656c --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-2.C @@ -0,0 +1,11 @@ +// Origin PR debug/47361 +// { dg-options "-g -std=gnu++0x -feliminate-dwarf2-dups -gdwarf-4" } + +typedef decltype (nullptr) nullptr_t; + +struct A +{ + A (nullptr_t = 0); +}; + +A a;