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

            Bug ID: 95909
           Summary: Wrong line information at Og
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: massarelli at diag dot uniroma1.it
  Target Milestone: ---

After executing function a, line 9 is wrongly hit.

$ cat -n a.c
cat -n aa.c 
     1  int d;
     2  char a() { return 0; }
     3  char f(b, c) {}
     4  void e() {
     5    int h;
     6    if (a()) {
     7      char g;
     8      d = 0;
     9      h = (f(g, 7));
    10    }
    11  }
    12  int main() { e(); }

$ cat -n a.c
int d;
char a() { return 0; }
char f(b, c) {}
void e() {
  int h;
  if (a()) {
    char g;
    d = 0;
    h = (f(g, 7));
  }
}
int main() { e(); }

$ gcc -v
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/tmp/gcc_build --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200624 (experimental) (GCC)

$ gcc -Og -g -o opt a.c

$ gdb opt
(gdb) b main
Breakpoint 1 at 0x4004a6: file a.c, line 12.
(gdb) r
Starting program: opt 
Breakpoint 1, main () at /home/stepping/output/a.c:12
12      int main() { e(); }
(gdb) s
e () at /home/stepping/output/a.c:6
6         if (a()) {
(gdb) s
a () at /home/stepping/output/a.c:2
2       char a() { return 0; }
(gdb) s
e () at /home/stepping/output/a.c:9
9           h = (f(g, 7));
(gdb) s
0x00007ffff7a05b97 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
(gdb)

Reply via email to