[Bug debug/93941] New: gcc generates wrong debug information at -O2
qrzhang at gatech dot edu
gcc-bugzilla@gcc.gnu.org
Wed Feb 26 04:31:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93941
Bug ID: 93941
Summary: gcc generates wrong debug information at -O2
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 recent regression.
My bisect points to g:82e8e335f917b9ce40801838c (needs double check).
$ gcc-trunk -v
gcc version 10.0.1 20200225 (experimental) [master revision
2473c81cb2d:31b6c240eeb:81c833b311b16cfd87a947374d5ffbbd48facd03] (GCC)
## correct output
$ gcc abc.c ; ./a.out
10
## wrong value (i=1) at -O2
$ gcc-trunk -g -O2 abc.c
$ gdb -x cmds -batch a.out
Breakpoint 1 at 0x400451: file abc.c, line 15.
Breakpoint 1, main () at abc.c:15
15 printf("%d\n", i);
$1 = 1
Kill the program being debugged? (y or n) [answered Y; input not from terminal]
[Inferior 1 (process 2788) killed]
$ cat abc.c
volatile int a;
char b[10][10][1];
int c;
int main() {
int i, d;
i = 0;
for (; i < 10; i++) {
c = 0;
for (; c < 10; c++) {
d = 0;
for (; d < 1; d++)
a = b[i][c][d];
}
}
printf("%d\n", i);
}
$ cat cmds
b abc.c:15
r
p i
kill
q
More information about the Gcc-bugs
mailing list