https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81155
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- As make check-gcc RUNTESTFLAGS='--target_board=unix\{-fno-reorder-blocks-and-partition,-freorder-blocks-and-partition\} guality.exp=pr43051-1.c' shows, it is a -freorder-blocks-and-partition related, but it actually isn't about missing debug info for those vars, it is all there. gdb ./pr43051-1.exe (gdb) b pr43051-1.c:34 Breakpoint 2 at 0x4005ff: file /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr43051-1.c, line 34. (gdb) r Starting program: /usr/src/gcc/obj/gcc/pr43051-1.exe Breakpoint 2, bar (c=0x601060 <a>, v=1, e=0x601070 <a+16>) at /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr43051-1.c:34 34 foo ("c", (__UINTPTR_TYPE__) c, 0); /* { dg-final { gdb-test 34 "c" "\&a\[0\]" } } */ (gdb) p c $1 = (struct S *) 0x601060 <a> (gdb) n 35 foo ("v", v, 1); /* { dg-final { gdb-test 35 "v" "1" } } */ (gdb) p v $2 = 1 (gdb) n 36 foo ("e", (__UINTPTR_TYPE__) e, 2); /* { dg-final { gdb-test 36 "e" "\&a\[1\]" } } */ (gdb) p e $3 = (struct S *) 0x601070 <a+16> (gdb) b 39 Breakpoint 3 at 0x4005c0: file /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr43051-1.c, line 39. (gdb) c Continuing. Breakpoint 3, bar (c=0x601060 <a>, v=1, e=0x601070 <a+16>) at /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr43051-1.c:39 39 foo ("c", (__UINTPTR_TYPE__) c, 3); /* { dg-final { gdb-test 39 "c" "\&a\[0\]" } } */ (gdb) p c $4 = (struct S *) 0x601060 <a> (gdb) n 40 foo ("v", v, 4); /* { dg-final { gdb-test 40 "v" "1" } } */ (gdb) p v $5 = 1 (gdb) n 41 foo ("e", (__UINTPTR_TYPE__) e, 5); /* { dg-final { gdb-test 41 "e" "\&a\[1\]" } } */ (gdb) p e $6 = (struct S *) 0x601070 <a+16> The reason it fails is different, in the logs there is: spawn gdb -nx -nw -quiet -batch -x pr43051-1.gdb ./pr43051-1.exe No line 34 in the current file. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] and indeed that is what one can see: gdba ./pr43051-1.exe (gdb) l 1 <artificial>: No such file or directory. (gdb) b 34 No line 34 in the current file. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 2 (34) pending. So, either gdb 8.0.1-33.fc27 is too old to handle the LTO debug info, or there is something wrong in it.