From patchwork Tue Mar 25 12:10:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Chandra X-Patchwork-Id: 333447 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 A50F21400A8 for ; Tue, 25 Mar 2014 23:10:48 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=JxBmqVsIyAk1as/0Ct06v3z1Mjs+0GhsE0vYhSYKUvKFr3 RI0d7brHO3cWFHcVnohVQSb++zpTlVn9bs9O6wh0H3+MfWZKioV8DMofTTBdJbFj 2TBGIsoOV+j3GK9Z6m9mw2pduu/UXBBMQvXRSAFXTFVtZjrsoWyeO9tkaxztA= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=5AtNnteTOri0RpEkTJXVPYgsKvs=; b=gdiwiguXEXnxbpSl02qt UosVW02vkaW158B5zE63TKWeyhK50K0IchjC3jr0v595HGMqPR10sEiMl89Sk3cB mIFOoHKopMq6vqACtwiNfhojKCz6g7ql+7V95AarFtE0q/GcCowH3NTCnmovVFb3 ftaqbPH+J0fBElBKBwZ8xSQ= Received: (qmail 31103 invoked by alias); 25 Mar 2014 12:10:41 -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 31090 invoked by uid 89); 25 Mar 2014 12:10:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ee0-f47.google.com Received: from mail-ee0-f47.google.com (HELO mail-ee0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 25 Mar 2014 12:10:38 +0000 Received: by mail-ee0-f47.google.com with SMTP id b15so362026eek.6 for ; Tue, 25 Mar 2014 05:10:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=SwKY4suXa+Qd6jZJmENvjtCOIPJffFrKKkgGmNBFmAQ=; b=aoqKpiqhxBZXyr+DUiaITsjH8QIhgU7p2rue+GCcZdUcGmRXXUXEBchZ+E9c0b8AXk Gu5IDJuyqPSJQ9G14HUe3ogzxoLc5Wq0IrHiYYFPzaP39MG/Y6Py1bhpDARsv5t9+9R+ 5SoFoktCU9oRTc5pmYb60RAzgZSDP1A8luxRCgprb9kMrdSwhQZYDZ+qF0ELw5HabZ8D uq4JBNaxI/3jPrwQPLAJX1aaqzCUv+kwV3hxUzE9KEgXMwdVyYaxtk689tyyioCKIjzQ Omi6TNrh5+eEAzaspXwgu6WgCT0n3wqMVXSmR5PDYJWF9sgnupp0jXM2DJYK252R7gAK Rixw== X-Gm-Message-State: ALoCoQkOJ4XimrD7p9hsZtgohg4VUrOMCf1DhBTaOduQ7dHUI+fpp/F0qeHeSdXO5B2gmgyv4hqdL0MaDKM8KT0ApnsI8M9XRSYpxvX8C6EQ0AekrlvimX3ZeIV7620VlI49BIm32I0fIhL58zsrWsg8Nja2T9EQNqh5Y62tsl6ejnJdZgRwoeXDWf+/InzdH3bgB1Oi4v0vPfx+bYsVtCZx7mBnp4EINA== MIME-Version: 1.0 X-Received: by 10.14.198.197 with SMTP id v45mr69845667een.9.1395749435573; Tue, 25 Mar 2014 05:10:35 -0700 (PDT) Received: by 10.15.48.194 with HTTP; Tue, 25 Mar 2014 05:10:35 -0700 (PDT) Date: Tue, 25 Mar 2014 05:10:35 -0700 Message-ID: Subject: [PATCH] PR debug/57519 - Emit DW_TAG_imported_declaration under the right class for 'using' statements in a class From: Siva Chandra To: gcc-patches@gcc.gnu.org X-IsSubscribed: yes Hello, This is a re-posting of the patch I had posted 2 weeks back. I could locate a PR for it, hence I am posting it now with the PR annotations. Though the bug is in the 'debug' component, because of the nature of the fix, I think it should be treated as a bug in the 'c++' component. The patch is attached. Link to the previous posting: http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00587.html ChangeLog: 2014-03-25 Siva Chandra Reddy Fix PR debug/57519 /cp PR debug/57519 * class.c (handle_using_decl): Pass the correct scope to cp_emit_debug_info_for_using. testsuite/ PR debug/57519 * g++.dg/debug/dwarf2/imported-decl-2.C: New testcase. Thanks, Siva Chandra diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b46391b..6ad82d7 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1299,7 +1299,7 @@ handle_using_decl (tree using_decl, tree t) old_value = NULL_TREE; } - cp_emit_debug_info_for_using (decl, USING_DECL_SCOPE (using_decl)); + cp_emit_debug_info_for_using (decl, t); if (is_overloaded_fn (decl)) flist = decl; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C new file mode 100644 index 0000000..70200ec --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C @@ -0,0 +1,32 @@ +// { dg-do compile } +// { dg-options "-gdwarf-2 -dA -O0 -fno-merge-debug-strings" } + +class AAAA +{ + public: + int method (void); + int a; +}; + +int +AAAA::method (void) +{ + return a; +} + +class BBBB : public AAAA +{ + public: + using AAAA::method; + + int method (int b); +}; + +int +BBBB::method (int b) +{ + return a + b; +} + +// { dg-final { scan-assembler-not "ascii \"BBBB\\\\0\".*ascii \"AAAA\\\\0\".*DW_TAG_imported_declaration" } } +// { dg-final { scan-assembler-times "ascii \"AAAA\\\\0\".*ascii \"BBBB\\\\0\".*DW_TAG_imported_declaration" 1 } }