[llvm-bugs] [Bug 46006] New: Wrong debug info generated at -O3 (-O0 is correct)
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 20 08:05:32 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46006
Bug ID: 46006
Summary: Wrong debug info generated at -O3 (-O0 is correct)
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: yangyibiao at hust.edu.cn
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
lldb outputs 0 when the program is compiled with "-O3". It behaves correctly
when the program is compiled with "-O0".
$ cat small.c
void foo(int *a) {
(*a)++;
}
int main() {
int a = 0;
foo (&a);
return 0;
}
$ cat cmds
b 8
r
p a
$ clang --version
clang version 11.0.0 (/home/yibiao/.cache/yay/llvm-git/llvm-project
871beba234a83a2a02da9dedbd59b91a1bfbd7af)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ lldb --version
lldb version 11.0.0
clang revision 871beba234a83a2a02da9dedbd59b91a1bfbd7af
llvm revision 871beba234a83a2a02da9dedbd59b91a1bfbd7af
$ clang -g -O0 small.c
$ lldb -s cmds -b a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) command source -s 0 'cmds'
Executing commands in '/home/yibiao/Debugger/cmds'.
(lldb) b 8
Breakpoint 1: where = a.out`main + 33 at small.c:8:3, address =
0x0000000000401151
(lldb) r
Process 3458 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401151 a.out`main at small.c:8:3
5 int main() {
6 int a = 0;
7 foo (&a);
-> 8 return 0;
9 }
Process 3458 launched: '/home/yibiao/Debugger/a.out' (x86_64)
(lldb) p a
(int) $0 = 1
$ clang -g -O3 small.c
$ lldb -s cmds -b a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) command source -s 0 'cmds'
Executing commands in '/home/yibiao/Debugger/cmds'.
(lldb) b 8
Breakpoint 1: where = a.out`main at small.c:8:3, address = 0x0000000000401120
(lldb) r
Process 3563 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401120 a.out`main at small.c:8:3
5 int main() {
6 int a = 0;
7 foo (&a);
-> 8 return 0;
9 }
Process 3563 launched: '/home/yibiao/Debugger/a.out' (x86_64)
(lldb) p a
(int) $0 = 0
--
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/20200520/a640268b/attachment.html>
More information about the llvm-bugs
mailing list