From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01DB838582BD; Wed, 21 Dec 2022 02:04:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01DB838582BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671588278; bh=ADnQSzPZu/t4Q5F9q9gFzGKPYP59bhjSkDk3cZ1J1rw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MHLqfW1wjju7U3HeEBVwdXJWMwMKXGsPfO3HPW64CQAg0FqWwM/EbKCeg3rtICv45 +Ks2J6z0Oq8yhxekTFdmqWoaq7glgMOVO9mTeYUSFydmqwb0pGH1o/A5voY1BmtuiS WQNGScwdN56uj9q3WAd4Ye3bjBwesU/tqiAU+0CY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/84471] Debugger jumps back to lambda capture location every time a captured variable is odr-used Date: Wed, 21 Dec 2022 02:04:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 7.3.0 X-Bugzilla-Keywords: c++-lambda, wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D84471 --- Comment #5 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:302485a70a33f3a86e85ad9051de2b51c5dc0bc0 commit r13-4812-g302485a70a33f3a86e85ad9051de2b51c5dc0bc0 Author: Jason Merrill Date: Thu Dec 1 22:58:28 2022 -0500 c++: source position of lambda captures [PR84471] If the DECL_VALUE_EXPR of a VAR_DECL has EXPR_LOCATION set, then any us= e of that variable looks like it has that location, which leads to the debug= ger jumping back and forth for both lambdas and structured bindings. Rather than fix all the uses, it seems simplest to remove any EXPR_LOCA= TION when setting DECL_VALUE_EXPR. So the cp/ hunks aren't necessary, but t= hey avoid the need to unshare to remove the location. PR c++/84471 PR c++/107504 gcc/cp/ChangeLog: * coroutines.cc (transform_local_var_uses): Don't specify a location for DECL_VALUE_EXPR. * decl.cc (cp_finish_decomp): Likewise. gcc/ChangeLog: * fold-const.cc (protected_set_expr_location_unshare): Not stat= ic. * tree.h: Declare it. * tree.cc (decl_value_expr_insert): Use it. include/ChangeLog: * ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): Add __. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/value-expr1.C: New test. * g++.dg/tree-ssa/value-expr2.C: New test. * g++.dg/analyzer/pr93212.C: Move warning.=