https://bugs.llvm.org/show_bug.cgi?id=40857
Bug ID: 40857
Summary: Wrong debug info generated at -O2 (-O0 is correct)
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Keywords: wrong-debug
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected]
$ cat outer.c
void optimize_me_not() {}
$ cat 7.c
int a[6];
int b;
int main() {
int i, c = 8;
for (; c; c--)
b = b >> 5;
i = 0;
for (; i < 7; i++)
for (; c < 2; c++)
b = b & 4095 ^ a[b & 255];
i = 0;
for (; i < 5; i++)
;
b = b >> 8 ^ 5;
optimize_me_not();
}
### -O2
(lldb) r
Process 16600 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 16600 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00000000004004be a.out`main at 7.c:15:3
12 for (; i < 5; i++)
13 ;
14 b = b >> 8 ^ 5;
-> 15 optimize_me_not();
16 }
(lldb) frame var
(int) c = 0
(int) i = 0
### -O0
Process 18140 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 18140 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000400562 a.out`main at 7.c:15:3
12 for (; i < 5; i++)
13 ;
14 b = b >> 8 ^ 5;
-> 15 optimize_me_not();
16 }
(lldb) frame var
(int) i = 5
(int) c = 2
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs