From patchwork Fri Feb 1 12:29:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1034723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495079-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="QRFsdDNH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43rbym2ZtQz9s9G for ; Fri, 1 Feb 2019 23:29:46 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=i3R9oIyBRBM9RQoYoEb2fj9mpXNfnvy7sw1tTZh8CK93eyYPIm TE4giLEAvsYHeKL9gV/iVNX6BxcQM8Pkfohi4f7drP5aAcNUdjwLSdZzQnv4ck+6 4voX5MxHeo8v6A7P+qPTe6a2AiP/p+XBNlyXoc1ccHWtO+S4zrOX1PZNc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=7jDuear1Uoa+cZymfi0Zgwtn8mc=; b=QRFsdDNHSDUxd9y8x3M2 iUlh7p7/DZaKLMLGmzdqdaQ8OMkkcfQrKaHnkEuUvEWOWvmTwORvc8BoZMIB2OUj isiTWT2ZYGl8h7sEs+wka8xa117GFdqQ+RS/v8heNK0sELKd1MVsboYZ9IHZUmqT eD7S+ajj01idH9kg5b5393E= Received: (qmail 88932 invoked by alias); 1 Feb 2019 12:29:39 -0000 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 Received: (qmail 88825 invoked by uid 89); 1 Feb 2019 12:29:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Feb 2019 12:29:37 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 971A0AC86; Fri, 1 Feb 2019 12:29:35 +0000 (UTC) Date: Fri, 1 Feb 2019 13:29:35 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: jason@redhat.com Subject: [PATCH] Another -fdebug-type-section fix Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 This fixes another case where we end up with duplicate stub DIEs and thus build_abbrev_table trying to adjust a DW_AT_signature ref to a local DIE. This happens when we have two unworthy DIEs from different type units rooted in stub DIEs themselves. Here copy_ancestor_tree records the stubs as original DIE that gets copied failing to see we already copied the thing. Bootstrap & regtest running on x86_64-unknown-linux-gnu. OK? Thanks, Richard. 2019-02-01 Richard Biener PR debug/87295 * dwarf2out.c (copy_ancestor_tree): Register non-stubs as orig. * g++.dg/debug/dwarf2/pr87295.C: New testcase. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 268446) +++ gcc/dwarf2out.c (working copy) @@ -8169,6 +8169,11 @@ copy_ancestor_tree (dw_die_ref unit, dw_ decl_table_entry **slot = NULL; struct decl_table_entry *entry = NULL; + /* If DIE refers to a stub unfold that so we get the appropriate + DIE registered as orig in decl_table. */ + if (dw_die_ref c = get_AT_ref (die, DW_AT_signature)) + die = c; + if (decl_table) { /* Check if the entry has already been copied to UNIT. */ Index: gcc/testsuite/g++.dg/debug/dwarf2/pr87295.C =================================================================== --- gcc/testsuite/g++.dg/debug/dwarf2/pr87295.C (nonexistent) +++ gcc/testsuite/g++.dg/debug/dwarf2/pr87295.C (working copy) @@ -0,0 +1,22 @@ +// { dg-additional-options "-fdebug-types-section" } +// { dg-require-effective-target c++11 } + +struct A {}; +namespace N { + struct B { + using C = struct H {}; + using D = A; + }; +} +struct E : N::B { + typedef C C; +}; +namespace N { + struct F { + E::C d; + E::D h; + }; +} +struct G { + N::F i; +} j;