https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107504
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] = f(buf); if (x != buf) throw 1; if (y != 1) throw 2; return 0; } Compiled with -g the debugger shows control jumping backwards to the structured 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 [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] = f(buf); 16 if (x != buf) 15 auto [x, y] = f(buf); 18 if (y != 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 [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] = { }; 15 auto [out, len] = std::format_to_n(buf, 3, "123 + 456 = {}", 579); 16 VERIFY( out == buf+3 ); 15 auto [out, len] = std::format_to_n(buf, 3, "123 + 456 = {}", 579); 16 VERIFY( out == buf+3 ); 15 auto [out, len] = std::format_to_n(buf, 3, "123 + 456 = {}", 579); 17 VERIFY( len == 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.