From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 676063858CDA; Tue, 1 Nov 2022 23:16:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 676063858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667344576; bh=5a+QunN0/n+fOCV/NdUsKkyxYPrRLUPpidTa4z7L9cc=; h=From:To:Subject:Date:From; b=IzS36CdEl3xvPb7SnhHOJXXTlsis9bUpzpmH95smAtSbydY9+6pZ2sIQKMpmffF/c L2184Aq+8aZfaCSK3WQ5naLeWs6bvxRfi2Y5xNFEC5UzpDv9X/pTpVbdPTNowAoWVH 58T7yjKld23zsE2dneqnhsOs/Qr8xbLn7CBVC9ZU= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107504] New: Debugger jumps back to structured binding declaration Date: Tue, 01 Nov 2022 23:16:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D107504 Bug ID: 107504 Summary: Debugger jumps back to structured binding declaration Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- struct S { void* i; int j; }; S f(char* p) { return {p, 1}; } int main() { char buf[1]; auto [x, y] =3D f(buf); if (x !=3D buf) throw 1; if (y !=3D 1) throw 2; return 0; } Compiled with -g the debugger shows control jumping backwards to the struct= ured binding declaration: $ gdb --quiet -ex start -ex n -ex n -ex n -ex n a.out Reading symbols from a.out... Temporary breakpoint 1 at 0x40115f: file sb.C, line 15. Starting program: /tmp/a.out=20 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Temporary breakpoint 1, main () at sb.C:15 15 auto [x, y] =3D f(buf); 16 if (x !=3D buf) 15 auto [x, y] =3D f(buf); 18 if (y !=3D 1) 20 return 0; For a slightly larger piece of code I see it jump back to it three times: $ gdb --quiet -ex start -ex step -ex n -ex n -ex n -ex n -ex n -ex n -ex n a.out Reading symbols from a.out... Temporary breakpoint 1 at 0x405aa3: file fton.C, line 43. Starting program: /tmp/a.out=20 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Temporary breakpoint 1, main () at fton.C:43 43 test(); test () at fton.C:14 14 char buf[4] =3D { }; 15 auto [out, len] =3D std::format_to_n(buf, 3, "123 + 456 =3D {}", = 579); 16 VERIFY( out =3D=3D buf+3 ); 15 auto [out, len] =3D std::format_to_n(buf, 3, "123 + 456 =3D {}", = 579); 16 VERIFY( out =3D=3D buf+3 ); 15 auto [out, len] =3D std::format_to_n(buf, 3, "123 + 456 =3D {}", = 579); 17 VERIFY( len =3D=3D 15 ); 19 std::locale loc({}, new punct); Notice line 15 occurs three times. I haven't been able to reproduce that in= the minimized test case.=