From patchwork Thu Sep 6 02:46:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cary Coutant X-Patchwork-Id: 181994 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 64E7B2C0094 for ; Thu, 6 Sep 2012 12:46:46 +1000 (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=1347504407; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=WcmJ8oJ Ewo/cdHWXSyZKim8ZoBc=; b=Lv9VJ4ClLnwshXtAm0dm/d6V3HEgoRHQA+YOz1I 5JsNWDeBnXBwh324LsDGh5TmnD4jRJ32RXztAYm/5ISUiRLr8/zHZwVi8uV7mcg3 wxtUho5Sma9eUvPWAI5jKRm7dN34vW1ovvX+sdHyH4/T12OBJCJW3wjPAeXsfkqw zJ44= 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:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=s3/I5ckRhVeZTcB/L3wJwquZsn8HEXetMvLGLBMobLNY2EXzLuuiqSpfWXiM7x WVG/mafIH5/NqV45UFwphyYylGgVbQHLD9qtieKBujCglFhirtXvBF9rYGPSugt/ zhAdNFC7ubiculvZkx+HFaezuJnfyOrpD3KGefYhlegVg=; Received: (qmail 12609 invoked by alias); 6 Sep 2012 02:46:40 -0000 Received: (qmail 12600 invoked by uid 22791); 6 Sep 2012 02:46:39 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_GD, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-gg0-f201.google.com (HELO mail-gg0-f201.google.com) (209.85.161.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 06 Sep 2012 02:46:21 +0000 Received: by ggnb1 with SMTP id b1so143515ggn.2 for ; Wed, 05 Sep 2012 19:46:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=PBRKyXodq0ThktR+IIE83H11PLArQP1qvaQT70JY/T4=; b=haSZE4eEziUupu6bPTUPjWwWMFI7rTv/6MmCwmVr0iERxRKPLO0XY/zfsh4nQKfitO 6bq7flDsOtzvMS8QRM9OMOcEbtTgSvgGb6vua7bQZ7lbfKZBmNw35yj+BTa5lH6etBK2 7wpj+6R9mSvlaTG/iv7P5KUq+XayoRJh9bv3VW/QkkX9WRwtYVvMQciAVA8RuzRpOi5N nBM1zv7ETJ+Xv0dXMU49O493ODvCq7+PLNgxm7MJ0rMVFD976pz3kgkEhOLbLX6wqXcH pBjA7XiQccEvEqQfBAHQx5hn8el7wSDUiek1ynZ5pCbiMDj1sxc3P7Fak+pCnh/M1w5W HywQ== Received: by 10.236.83.39 with SMTP id p27mr370622yhe.27.1346899580771; Wed, 05 Sep 2012 19:46:20 -0700 (PDT) Received: by 10.236.83.39 with SMTP id p27mr370616yhe.27.1346899580714; Wed, 05 Sep 2012 19:46:20 -0700 (PDT) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id c61si219775yhm.3.2012.09.05.19.46.20 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 05 Sep 2012 19:46:20 -0700 (PDT) Received: from ccoutant.mtv.corp.google.com (ccoutant.mtv.corp.google.com [172.18.110.42]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 9A0D31E0043; Wed, 5 Sep 2012 19:46:20 -0700 (PDT) Received: by ccoutant.mtv.corp.google.com (Postfix, from userid 62097) id 37571E07F2; Wed, 5 Sep 2012 19:46:20 -0700 (PDT) To: gcc-patches@gcc.gnu.org, ppluzhnikov@google.com Subject: [google/gcc-4_7] Backport patch for comdat types problem Message-Id: <20120906024620.37571E07F2@ccoutant.mtv.corp.google.com> Date: Wed, 5 Sep 2012 19:46:20 -0700 (PDT) From: ccoutant@google.com (Cary Coutant) X-Gm-Message-State: ALoCoQloN8ZppFQuczMY+4o+9ELkhgeAnYkizVs8wukye4Jf/qwAv/+qJzZErT5whsZ6BJGUFUqfHJun/pxzJfVP2SeheJu05d7GQrEeigmySipEQcQx1nKW3gE4QG76LwqpCg5IQwtHqli/X4gFuaSiziPK/LsYPL89EpHy6WetKnijrjRLCV8iuevpTt16b9JiliaQIlou8AXE4Ohcvnzlq9GUJs5TRuIfJxcrvhT0IehtjsvyGtg= 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 This patch is for the google/gcc-4_7 branch. Backport upstream patch to fix a problem where type signature does not include the type's context. Tested with bootstrap and regression tests. 2012-07-19 Jason Merrill PR debug/53235 * dwarf2out.c (get_die_parent): New. (generate_type_signature): Use it. Index: gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C =================================================================== --- gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C (revision 0) +++ gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C (revision 0) @@ -0,0 +1,14 @@ +// PR debug/53235 +// { dg-options "-gdwarf-4" } +// { dg-final { scan-assembler-times "debug_types" 2 } } + +namespace E { + class O {}; + void f (O o) {} +} +namespace F { + class O {}; + void f (O fo) {} +} +E::O eo; +int main () {} Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 190940) +++ gcc/dwarf2out.c (working copy) @@ -5066,6 +5066,23 @@ get_AT (dw_die_ref die, enum dwarf_attri return NULL; } +/* Returns the parent of the declaration of DIE. */ + +static dw_die_ref +get_die_parent (dw_die_ref die) +{ + dw_die_ref t; + + if (!die) + return NULL; + + if ((t = get_AT_ref (die, DW_AT_abstract_origin)) + || (t = get_AT_ref (die, DW_AT_specification))) + die = t; + + return die->die_parent; +} + /* Return the "low pc" attribute value, typically associated with a subprogram DIE. Return null if the "low pc" attribute is either not present, or if it cannot be represented as an assembler label identifier. */ @@ -6698,9 +6715,11 @@ generate_type_signature (dw_die_ref die, unsigned char checksum[16]; struct md5_ctx ctx; dw_die_ref decl; + dw_die_ref parent; name = get_AT_string (die, DW_AT_name); decl = get_AT_ref (die, DW_AT_specification); + parent = get_die_parent (die); /* First, compute a signature for just the type name (and its surrounding context, if any. This is stored in the type unit DIE for link-time @@ -6711,8 +6730,8 @@ generate_type_signature (dw_die_ref die, md5_init_ctx (&ctx); /* Checksum the names of surrounding namespaces and structures. */ - if (decl != NULL && decl->die_parent != NULL) - checksum_die_context (decl->die_parent, &ctx); + if (parent != NULL) + checksum_die_context (parent, &ctx); md5_process_bytes (&die->die_tag, sizeof (die->die_tag), &ctx); md5_process_bytes (name, strlen (name) + 1, &ctx); @@ -6728,8 +6747,8 @@ generate_type_signature (dw_die_ref die, die->die_mark = mark; /* Checksum the names of surrounding namespaces and structures. */ - if (decl != NULL && decl->die_parent != NULL) - checksum_die_context (decl->die_parent, &ctx); + if (parent != NULL) + checksum_die_context (parent, &ctx); /* Checksum the DIE and its children. */ die_checksum_ordered (die, &ctx, &mark);