public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable
@ 2022-10-04 20:43 redi at gcc dot gnu.org
  2022-10-04 20:44 ` [Bug debug/107154] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-04 20:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

            Bug ID: 107154
           Summary: GDB jumping to end of block when stepping over
                    construction of local variable
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <initializer_list>
#include <string>

struct X {
  X(std::initializer_list<std::string>, int) { }
};

int main()
{
  X x( {"", "", "", ""}, 1|4 );
  return 0;
}

tmp$ g++ -g debug.C -o debug
tmp$ gdb -q debug
Reading symbols from debug...
(gdb) start
Temporary breakpoint 1 at 0x40123a: file debug.C, line 12.
Starting program: /tmp/debug 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 1, main () at debug.C:12
12      }
(gdb) n
10        X x( {"", "", "", ""}, 1|4 );
(gdb) 
12      }
(gdb) 
11        return 0;
(gdb) 
__libc_start_call_main (main=main@entry=0x401226 <main()>, argc=argc@entry=1,
argv=argv@entry=0x7fffffffd7a8) at ../sysdeps/nptl/libc_start_call_main.h:74
74        exit (result);
(gdb) 
[Inferior 1 (process 577012) exited normally]


Why does "start" break on the closing brace of main(), and then the
construction of 'x' also jumps to the closing brace?

In less trivial examples I've seen it jump back and forth multiple times:

243             libmap libs;
(gdb) n
245       redi::ipstream in({"ldd", argv[arg]}, pstdout|pstderr);
(gdb) 
310     }
(gdb) 
245       redi::ipstream in({"ldd", argv[arg]}, pstdout|pstderr);
(gdb) 
310     }
(gdb) 
245       redi::ipstream in({"ldd", argv[arg]}, pstdout|pstderr);
(gdb) 
[Detaching after fork from child process 845854]
310     }
(gdb)

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

* [Bug debug/107154] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
@ 2022-10-04 20:44 ` redi at gcc dot gnu.org
  2022-10-04 20:44 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-04 20:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is with the Fedora packages but I see it with GCC trunk too.

$ rpm -q gcc gdb
gcc-12.2.1-2.fc36.x86_64
gdb-12.1-1.fc36.x86_64

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

* [Bug debug/107154] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
  2022-10-04 20:44 ` [Bug debug/107154] " redi at gcc dot gnu.org
@ 2022-10-04 20:44 ` pinskia at gcc dot gnu.org
  2022-10-04 20:48 ` [Bug debug/107154] [12/13 Regression] " jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-04 20:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think there is another bug about this one ...

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

* [Bug debug/107154] [12/13 Regression] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
  2022-10-04 20:44 ` [Bug debug/107154] " redi at gcc dot gnu.org
  2022-10-04 20:44 ` pinskia at gcc dot gnu.org
@ 2022-10-04 20:48 ` jason at gcc dot gnu.org
  2022-10-04 21:01 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2022-10-04 20:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-10-04
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
                 CC|                            |jason at gcc dot gnu.org

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

* [Bug debug/107154] [12/13 Regression] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-10-04 20:48 ` [Bug debug/107154] [12/13 Regression] " jason at gcc dot gnu.org
@ 2022-10-04 21:01 ` redi at gcc dot gnu.org
  2022-10-04 22:54 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-04 21:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It started with r12-6329

 c++: EH and partially constructed aggr temp [PR66139]

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

* [Bug debug/107154] [12/13 Regression] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-10-04 21:01 ` redi at gcc dot gnu.org
@ 2022-10-04 22:54 ` cvs-commit at gcc dot gnu.org
  2022-10-06 10:39 ` [Bug debug/107154] [12 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-04 22:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:ce3a1b5976079b1467473b4628f05797fd2eae08

commit r13-3072-gce3a1b5976079b1467473b4628f05797fd2eae08
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Oct 4 17:06:04 2022 -0400

    c++: fix debug info for array temporary [PR107154]

    In the testcase the elaboration of the array init that happens at
genericize
    time was getting the location info for the end of the function; fixed by
    doing the expansion at the location of the original expression.

            PR c++/107154

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_genericize_init_expr): Use iloc_sentinel.
            (cp_genericize_target_expr): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/debug/dwarf2/lineno-array1.C: New test.

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

* [Bug debug/107154] [12 Regression] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-10-04 22:54 ` cvs-commit at gcc dot gnu.org
@ 2022-10-06 10:39 ` rguenth at gcc dot gnu.org
  2023-04-18 20:45 ` cvs-commit at gcc dot gnu.org
  2023-04-18 20:47 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-06 10:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] GDB      |[12 Regression] GDB jumping
                   |jumping to end of block     |to end of block when
                   |when stepping over          |stepping over construction
                   |construction of local       |of local variable
                   |variable                    |
   Target Milestone|---                         |12.3
           Priority|P3                          |P2
      Known to work|                            |13.0
      Known to fail|13.0                        |

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

* [Bug debug/107154] [12 Regression] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-10-06 10:39 ` [Bug debug/107154] [12 " rguenth at gcc dot gnu.org
@ 2023-04-18 20:45 ` cvs-commit at gcc dot gnu.org
  2023-04-18 20:47 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-18 20:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:2088358b658c44f69d37af0d7deec321f557741d

commit r12-9430-g2088358b658c44f69d37af0d7deec321f557741d
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Oct 4 17:06:04 2022 -0400

    c++: fix debug info for array temporary [PR107154]

    In the testcase the elaboration of the array init that happens at
genericize
    time was getting the location info for the end of the function; fixed by
    doing the expansion at the location of the original expression.

            PR c++/107154

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_genericize_init_expr): Use iloc_sentinel.
            (cp_genericize_target_expr): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/debug/dwarf2/lineno-array1.C: New test.

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

* [Bug debug/107154] [12 Regression] GDB jumping to end of block when stepping over construction of local variable
  2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-04-18 20:45 ` cvs-commit at gcc dot gnu.org
@ 2023-04-18 20:47 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2023-04-18 20:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107154

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12.3/13.

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

end of thread, other threads:[~2023-04-18 20:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 20:43 [Bug debug/107154] New: GDB jumping to end of block when stepping over construction of local variable redi at gcc dot gnu.org
2022-10-04 20:44 ` [Bug debug/107154] " redi at gcc dot gnu.org
2022-10-04 20:44 ` pinskia at gcc dot gnu.org
2022-10-04 20:48 ` [Bug debug/107154] [12/13 Regression] " jason at gcc dot gnu.org
2022-10-04 21:01 ` redi at gcc dot gnu.org
2022-10-04 22:54 ` cvs-commit at gcc dot gnu.org
2022-10-06 10:39 ` [Bug debug/107154] [12 " rguenth at gcc dot gnu.org
2023-04-18 20:45 ` cvs-commit at gcc dot gnu.org
2023-04-18 20:47 ` 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).