[Bug debug/89528] New: Wrong debug info generated at -Og [gcc-trunk]

dccitaliano at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 28 03:42:00 GMT 2019


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

            Bug ID: 89528
           Summary: Wrong debug info 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 5.c
char b;
int d, e;
static int i = 1;
void a(l) { printf("", l); }
char(c)(char l) { return l || b && l == 1 ? b : b % l; }
short(f)(l, m) { return l * m; }
short(g)(short l, short m) { return m || l == 767 && m == 1; }
int(h)(l, m) { return (l ^ m & l ^ (m & 647) - m ^ m) < m; }
static int(j)(l) { return d == 0 || l == 647 && d == 1 ? l : l % d; }
short(k)(l) { return l >= 2 >> l; }
static short n(void) {
  int l_1127 = ~j(9 || 0) ^ 65535;
  optimize_me_not();
  f(l_1127, i && e ^ 4) && g(0, 0);
  e = 0;
  return 5;
}
int main() { n(); }

$ cat outer.c
void optimize_me_not() {}


### -Og

Reading symbols from ./a.out...
(gdb) b 13
Breakpoint 1 at 0x400590: file 5.c, line 13.
(gdb) r
Starting program: /home/davide/finished-reducing-gcc/a.out

Breakpoint 1, n () at 5.c:13
13        optimize_me_not();
(gdb) info locals
l_1127 = -4258335

### -O0

Reading symbols from ./a.out...
(gdb) b 13
Breakpoint 1 at 0x40064c: file 5.c, line 13.
(gdb) r
Starting program: /home/davide/finished-reducing-gcc/a.out

Breakpoint 1, n () at 5.c:13
13        optimize_me_not();
(gdb) info locals
l_1127 = -65535

$ 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.


More information about the Gcc-bugs mailing list