https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94005
Bug ID: 94005 Summary: gcc generates wrong debug information at -Og Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: qrzhang at gatech dot edu Target Milestone: --- It appears to be a regression in gcc-9. bisection points to g:36f6476b80ca559ff0fc436d2ab84130b The value of l at line 11 is 153. At -Og it generates l=0. O3 and O2 works fine. $ gcc-trunk -v gcc version 10.0.1 20200302 (experimental) [master revision 778a77357ca:87d8bb8fb8c:917e56a94f9d3189d7fa9d1944b7513258195887] (GCC) #correct value: $ gcc-trunk -g abc.c $ gdb -x cmds -batch a.out Breakpoint 1 at 0x4004ec: file abc.c, line 11. Breakpoint 1, i () at abc.c:11 11 l = e; // optimize_me_not() $1 = 153 Kill the program being debugged? (y or n) [answered Y; input not from terminal] [Inferior 1 (process 24999) killed] #incorrect value: $ gcc-trunk -g -Og abc.c $ gdb -x cmds -batch a.out Breakpoint 1 at 0x400495: file abc.c, line 11. Breakpoint 1, i () at abc.c:11 11 l = e; // optimize_me_not() $1 = 0 Kill the program being debugged? (y or n) [answered Y; input not from terminal] [Inferior 1 (process 32681) killed] $ cat abc.c int a, b = -7L; short d; static int e; char f; char g() {} int h(c) {} void i() { int l; (a && g()) > (e && h(d = 5)); f = l = b & 159; l = e; // b here } int main() { i(); } $ cat cmds b abc.c:11 r p l kill q