https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95898
Bug ID: 95898
Summary: Wrong backtrace infromation 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: ---
When line 5 is hit for the second time gdb shows function b in the top of the
backtrace while line 5 belong to function main.
$ cat -n a.c
1 int a;
2 void b() { printf("%X\n"); }
3 int main() {
4 a = 1;
5 b();
6 }
$ cat a.c
int a;
void b() { printf("%X\n"); }
int main() {
a = 1;
b();
}
$ 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 -O3 -g -o out a.c
$ gdb out
Breakpoint 1, main () at a.c:4
4 a = 1;
(gdb) bt
#0 main () at a.c:4
(gdb) s
5 b();
(gdb) bt
#0 main () at a.c:5
(gdb) s
b () at a.c:5
5 b();
(gdb) bt
#0 b () at a.c:5
#1 main () at a.c:5
(gdb) s
FFFFE668
0x00007ffff7a05b97 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
(gdb)