https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89530
Bug ID: 89530 Summary: Wrong debug informations for C array generated at -Og [gcc-trunk] Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: dccitaliano at gmail dot com Target Milestone: --- $ cat a.c int e, g; short f; char h; short(a)(b) {} int(c)(d) {} void i() { int j, k; unsigned short l_1404[3][9] = {58143, 8, 5, 80}; for (; f; f = 0) if (h) e = l_1404[0][7]; else { for (; g;) j = k = c(j); e = a(k); } optimize_me_not(); } int main() { i(); } $ cat outer.c void optimize_me_not() {} ### -O0 Reading symbols from ./a.out... (gdb) b 17 Breakpoint 1 at 0x40055c: file 3.c, line 17. (gdb) r Starting program: /home/davide/finished-reducing-gcc/a.out Breakpoint 1, i () at 3.c:17 17 optimize_me_not(); (gdb) p l_1404[0][0] $1 = 58143 ### -Og Reading symbols from ./a.out... (gdb) b 17 Breakpoint 1 at 0x4004f5: file 3.c, line 17. (gdb) r Starting program: /home/davide/finished-reducing-gcc/a.out Breakpoint 1, i () at 3.c:17 17 optimize_me_not(); (gdb) p l_1404[0][0] $1 = 9 $ gcc-trunk --version gcc-trunk (GCC) 9.0.1 20190227 (experimental) [trunk revision 269248] Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gdb-trunk --version GNU gdb (GDB) 8.3.50.20190227-git Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.