[llvm-bugs] [Bug 41628] New: Clang-trunk Generates Wrong Debug values with -O1
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Apr 27 13:42:03 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41628
Bug ID: 41628
Summary: Clang-trunk Generates Wrong Debug values with -O1
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Keywords: wrong-debug
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: yuanboli233 at gmail.com
CC: davide at freebsd.org, jdevlieghere at apple.com,
keith.walker at arm.com, llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
This problem also affects O2 and O3
$ clang-trunk --version
clang version 9.0.0 (trunk 355785)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ lldb-trunk --version
lldb version 9.0.0 (https://llvm.org/svn/llvm-project/lldb/trunk revision
355785)
clang revision 355785
llvm revision 355785
$ cat abc.c
static char a(int p_15) {
optimize_me_not();
return p_15;
}
int main() { a(2534103781 | 1677553596); }
$ cat outer.c
optimize_me_not() {}
$ cat cmds
b 2
r
p p_15
kill
q
$ clang-trunk -g -O0 abc.c outer.c
$ lldb-trunk -s cmds -b a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) command source -s 0 'cmds'
Executing commands in '/home/ybli/Projects/LLDB-testing/reduce.llvm/cmds'.
(lldb) b 2
Breakpoint 1: where = a.out`a + 11 at abc.c:2:3, address = 0x00000000004004ab
(lldb) r
Process 31358 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00000000004004ab a.out`a(p_15=-134250499) at abc.c:2:3
1 static char a(int p_15) {
-> 2 optimize_me_not();
3 return p_15;
4 }
5 int main() { a(2534103781 | 1677553596); }
Process 31358 launched: '/home/ybli/Projects/LLDB-testing/reduce.llvm/a.out'
(x86_64)
(lldb) p p_15
(int) $0 = -134250499
(lldb) kill
Process 31358 exited with status = 9 (0x00000009)
(lldb) q
$ clang-trunk -g -O1 abc.c outer.c
$ lldb-trunk -s cmds -b a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) command source -s 0 'cmds'
Executing commands in '/home/ybli/Projects/LLDB-testing/reduce.llvm/cmds'.
(lldb) b 2
Breakpoint 1: where = a.out`a at abc.c:2:3, address = 0x0000000000400490
(lldb) r
Process 21531 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000400490 a.out`a(p_15=-3) at abc.c:2:3
1 static char a(int p_15) {
-> 2 optimize_me_not();
3 return p_15;
4 }
5 int main() { a(2534103781 | 1677553596); }
Process 21531 launched: '/home/ybli/Projects/LLDB-testing/reduce.llvm/a.out'
(x86_64)
(lldb) p p_15
(int) $0 = -3
(lldb) kill
Process 21531 exited with status = 9 (0x00000009)
(lldb) q
pass bisection suggests that this problem is related to Tail Call Elimination:
working:
BISECT: running pass (30) Combine redundant instructions on function (a)
BISECT: NOT running pass (31) Tail Call Elimination on function (a)
not working:
BISECT: running pass (30) Combine redundant instructions on function (a)
BISECT: running pass (31) Tail Call Elimination on function (a)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190427/a486b1e0/attachment.html>
More information about the llvm-bugs
mailing list