public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107504] New: Debugger jumps back to structured binding declaration
@ 2022-11-01 23:16 redi at gcc dot gnu.org
  2022-11-01 23:22 ` [Bug c++/107504] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-01 23:16 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-02 22:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 23:16 [Bug c++/107504] New: Debugger jumps back to structured binding declaration redi at gcc dot gnu.org
2022-11-01 23:22 ` [Bug c++/107504] " pinskia at gcc dot gnu.org
2022-11-01 23:26 ` pinskia at gcc dot gnu.org
2022-11-02 11:58 ` redi at gcc dot gnu.org
2022-11-02 14:08 ` pinskia at gcc dot gnu.org
2022-12-02  4:01 ` jason at gcc dot gnu.org
2022-12-21  2:04 ` cvs-commit at gcc dot gnu.org
2023-03-02 22:24 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).