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

            Bug ID: 93954
           Summary: gcc generates wrong debug information at -O3
           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-8. The code is pretty self-explanatory.

Bisection points to g:bd2b9f1e2d67ec8e88c977154ecfee



$ gcc-trunk -v
gcc version 10.0.1 20200226 (experimental) [master revision
4d213bf6011:5d3c19b2ec6:ce25177f505ea75b3c0833c3f3f0072b97ee1b44] (GCC)


#It incorrectly prints i = 2580636200

$ gcc-trunk -g-O3 abc.c
$ gdb -x cmds -batch a.out
Breakpoint 1 at 0x4003a0: file abc.c, line 4.

Breakpoint 1, main () at abc.c:4
4         ;// b here
$1 = 2580636200
Kill the program being debugged? (y or n) [answered Y; input not from terminal]
[Inferior 1 (process 17508) killed]


$ cat abc.c
int main() {
  unsigned i = 2580636200;
  i--;
  ;// b here
}


$ cat cmds
b abc.c:4
r
p i
kill
q

Reply via email to