From patchwork Mon Dec 19 23:15:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 132336 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 C6849B7046 for ; Tue, 20 Dec 2011 10:16:12 +1100 (EST) Received: (qmail 24646 invoked by alias); 19 Dec 2011 23:16:07 -0000 Received: (qmail 24635 invoked by uid 22791); 19 Dec 2011 23:16:05 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM 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, 19 Dec 2011 23:15:47 +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.14.4/8.14.4) with ESMTP id pBJNFiGL026925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 Dec 2011 18:15:44 -0500 Received: from localhost (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pBJNFhGc025318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 19 Dec 2011 18:15:44 -0500 Received: by localhost (Postfix, from userid 500) id A522029C13B; Tue, 20 Dec 2011 00:15:42 +0100 (CET) From: Dodji Seketeli To: Jakub Jelinek Cc: Jason Merrill , GCC Patches Subject: Re: [PATCH] [RFC] PR debug/49951 - jumpy stepping at end of scope in C++ References: <4EEB9E6D.2090204@redhat.com> <20111219225805.GN1957@tyan-ft48-01.lab.bos.redhat.com> X-URL: http://www.redhat.com Date: Tue, 20 Dec 2011 00:15:42 +0100 In-Reply-To: <20111219225805.GN1957@tyan-ft48-01.lab.bos.redhat.com> (Jakub Jelinek's message of "Mon, 19 Dec 2011 23:58:05 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 Jakub Jelinek writes: > On Mon, Dec 19, 2011 at 11:54:36PM +0100, Dodji Seketeli wrote: >> PR debug/49951 >> * g++.dg/gcov/gcov-2.C: New test. > > This change doesn't look like New test, just an adjustment to it... Correct. Below is the adjusted patch. gcc/cp/ PR debug/49951 * decl.c (cxx_maybe_build_cleanup): Don't set location of the call to the destructor. gcc/testsuite/ PR debug/49951 * g++.dg/gcov/gcov-2.C: Adjust. --- gcc/cp/decl.c | 9 +++++++++ gcc/testsuite/g++.dg/gcov/gcov-2.C | 2 +- 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0a43fb8..2fc794b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13805,8 +13805,17 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) cleanup = call; } + /* build_delete sets the location of the destructor call to the + current location, even though the destructor is going to be + called later, at the end of the current scope. This can lead to + a "jumpy" behaviour for users of debuggers when they step around + the end of the block. So let's unset the location of the + destructor call instead. */ + if (cleanup != NULL && EXPR_P (cleanup)) + SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION); return cleanup; } + /* When a stmt has been parsed, this function is called. */ diff --git a/gcc/testsuite/g++.dg/gcov/gcov-2.C b/gcc/testsuite/g++.dg/gcov/gcov-2.C index 6d002f5..66d8af3 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-2.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-2.C @@ -20,7 +20,7 @@ private: void foo() { - C c; /* count(2) */ + C c; /* count(1) */ c.seti (1); /* count(1) */ }