[Bug debug/93954] gcc generates wrong debug information at -O3
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 27 10:29:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93954
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-debug
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-02-27
Version|unknown |10.0
Ever confirmed|0 |1
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So with GCC 7 we just have line number 5 and always print the value after
the decrement. With GCC 9 we claim we actually have sth at line 4
(but not earlier).
(gdb) start
Temporary breakpoint 1 at 0x4003a0: file t.c, line 4.
Starting program: /tmp/a.out
Temporary breakpoint 1, main () at t.c:4
4 ;// b here
(gdb) p i
$1 = 2580636200
(gdb) disassemble
Dump of assembler code for function main:
=> 0x00000000004003a0 <+0>: xor %eax,%eax
0x00000000004003a2 <+2>: retq
End of assembler dump.
(gdb) si
0x00000000004003a2 4 ;// b here
(gdb) p i
$2 = 2580636199
so now we have both values but with bogus line numbers for the pre-decrement
point. .optimized GIMPLE:
main ()
{
<bb 2> [local count: 1073741824]:
[t.c:2:3] # DEBUG BEGIN_STMT
[t.c:2:12] # DEBUG i => 2580636200
[t.c:3:3] # DEBUG BEGIN_STMT
[t.c:3:4] # DEBUG i => 2580636199
[t.c:4:3] # DEBUG BEGIN_STMT
[<built-in>:0:0] return 0;
which looks sensible. Not sure if a producer or consumer issue but not
having an instruction at line 3 makes things difficult (and value
2580636200 at line 4 is certainly wrong).
More information about the Gcc-bugs
mailing list