[llvm-bugs] [Bug 42170] New: Clang-trunk produce incorrect debug info under O1
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 6 11:51:52 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42170
Bug ID: 42170
Summary: Clang-trunk produce incorrect debug info under 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: aprantl at apple.com, 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, vsk at apple.com
$ 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
int b;
short(a)(c) { return c; }
int main() {
short d;
int e, p_40 = 0;
e = b + 1;
d = 26900 + e;
p_40 = d;
optimize_me_not();
a(p_40);
}
$ cat outer.c
optimize_me_not() {}
$ cat cmds
b 9
r
p p_40
kill
q
The debug info is correct under O0:
$ clang-trunk abc.c outer.c -O0 -g
$ 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 9
Breakpoint 1: where = a.out`main + 50 at abc.c:9:3, address =
0x00000000004004c2
(lldb) r
Process 27402 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00000000004004c2 a.out`main at abc.c:9:3
6 e = b + 1;
7 d = 26900 + e;
8 p_40 = d;
-> 9 optimize_me_not();
10 a(p_40);
11 }
Process 27402 launched: '/home/ybli/Projects/LLDB-testing/reduce.llvm/a.out'
(x86_64)
(lldb) p p_40
(int) $0 = 26901
(lldb) kill
Process 27402 exited with status = 9 (0x00000009)
(lldb) q
Under O1 the debug info is not correct:
$ clang-trunk abc.c outer.c -O1 -g
$ 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 9
Breakpoint 1: where = a.out`main + 1 at abc.c:9:3, address = 0x0000000000400491
(lldb) r
Process 9582 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000400491 a.out`main at abc.c:9:3
6 e = b + 1;
7 d = 26900 + e;
8 p_40 = d;
-> 9 optimize_me_not();
10 a(p_40);
11 }
Process 9582 launched: '/home/ybli/Projects/LLDB-testing/reduce.llvm/a.out'
(x86_64)
(lldb) p p_40
(int) $0 = 0
(lldb) kill
Process 9582 exited with status = 9 (0x00000009)
(lldb) q
Bisection suggest it is possibly related to "Deduce function attributes on SCC"
produce correct results:
BISECT: running pass (18) Remove unused exception handling info on SCC (a)
BISECT: NOT running pass (19) Deduce function attributes on SCC (a)
produce inccorect results:
BISECT: running pass (18) Remove unused exception handling info on SCC (a)
BISECT: running pass (19) Deduce function attributes on SCC (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/20190606/5ef97d92/attachment.html>
More information about the llvm-bugs
mailing list