From patchwork Wed Mar 18 17:03:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 451548 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B128140082 for ; Thu, 19 Mar 2015 04:04:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Nq/zp871; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=sGiWrSg4nHdZHFlNsAxsGYIJ7u2CGwfIJ0xxC4FS55oAgK 4n9P2Q5bwXLbOUpTpDXhov4+4TIIbFlVAjiWRoqAOUWxHJOZs19hy8RY8sUmQdaz aD74qQUv31VM6nF/D/RykHkwTRrXfnbV8xoX0gGX44BblVVClJkvrVm93LHL0= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=2/LUWXvn3DBGg6cn32RalKtIGso=; b=Nq/zp8711OYer6trWAeJ P/wsy4aXGZIISaE/Dx3dmcTFCi712AHrQghAGx0c+h/Fn7xnZYLZAkoM44Ruz1fB 1cN4NJR9GJFnXbTGXVj27WQFqabIgBlXUD8tx2EZdXzWVNz+ghHi3eb15G97IL8o f+JIet3Sv+3zloCX3RwS9gs= Received: (qmail 36608 invoked by alias); 18 Mar 2015 17:04:05 -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 36593 invoked by uid 89); 18 Mar 2015 17:04:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 18 Mar 2015 17:04:03 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2IH415p010794 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 18 Mar 2015 13:04:02 -0400 Received: from reynosa.quesejoda.com (vpn-54-165.rdu2.redhat.com [10.10.54.165]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2IH40sx032027; Wed, 18 Mar 2015 13:04:00 -0400 Message-ID: <5509AFFF.6070408@redhat.com> Date: Wed, 18 Mar 2015 10:03:59 -0700 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: gcc-patches , jason merrill Subject: [debug-early] Cache DW_TAG_label's if appropriate I'm running the gdb testsuite with the debug-early branch compiler, and fixing regressions. gdb.base/label.c was causing gdb to ICE because we were generating multiple DW_TAG_label's for the same DECL. Consequently, I have fixed gen_label_die to handle multiple calls with the same DECL. By the way Jason, is there any reason we previously called equate_decl_number_to_die() only for abstract instances?: if (DECL_ABSTRACT_P (decl)) equate_decl_number_to_die (decl, lbl_die); else { insn = DECL_RTL_IF_SET (decl); I was unable to find the original reasoning, because the original patch setting this was from the 1990s, and it came en-masse when dwarf2out.c was contributed. I don't see anything else in dwarf2out.c doing a lookup_decl_die() on a LABEL_DECL, so I don't even know why the equate_decl_number_to_die() is even there. Anyways, in the immortal words of Shaggy... "wasn't me", so I'm leaving this bit untouched. Tested on x86-64 Linux with the gdb regression suite. Committed to branch. Aldy commit 8fea2b5c37026b3121afc0a98630542bb9a733dd Author: Aldy Hernandez Date: Wed Mar 18 09:55:38 2015 -0700 Cache DW_TAG_label's if appropriate. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 30c6cc6..92f4903 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19725,14 +19725,20 @@ static void gen_label_die (tree decl, dw_die_ref context_die) { tree origin = decl_ultimate_origin (decl); - dw_die_ref lbl_die = new_die (DW_TAG_label, context_die, decl); + dw_die_ref lbl_die = lookup_decl_die (decl); rtx insn; char label[MAX_ARTIFICIAL_LABEL_BYTES]; - if (origin != NULL) - add_abstract_origin_attribute (lbl_die, origin); - else - add_name_and_src_coords_attributes (lbl_die, decl); + if (!lbl_die) + { + lbl_die = new_die (DW_TAG_label, context_die, decl); + equate_decl_number_to_die (decl, lbl_die); + + if (origin != NULL) + add_abstract_origin_attribute (lbl_die, origin); + else + add_name_and_src_coords_attributes (lbl_die, decl); + } if (DECL_ABSTRACT_P (decl)) equate_decl_number_to_die (decl, lbl_die);