[llvm-bugs] [Bug 46047] New: inconsistent behaviors at -O3
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 26 17:22:31 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46047
Bug ID: 46047
Summary: inconsistent behaviors at -O3
Product: lldb
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: lldb-dev at lists.llvm.org
Reporter: yangyibiao at hust.edu.cn
CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org
$ 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 -O3 -g small.c
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) b 11
Breakpoint 1: where = a.out`main + 79 at small.c:11:3, address =
0x000000000040117f
(lldb) r
Process 565482 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 565482 exited with status = 0 (0x00000000)
(lldb)
/****************************************
As showed above, Line 11 is not hit by LLDB when setting breakpoint at Line 11.
However, Line 11 is hit by LLDB when using step-i.
****************************************/
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 1 at small.c:6:10, address =
0x0000000000401131
(lldb) r
Process 565440 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 565440 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401131 a.out`main at small.c:6:10
3
4 int main() {
5 for (int e=0; e<10; e++)
-> 6 d[e] = 1;
7 if (d[0])
8 c = a = (b == 0 || 1 % b);
9 if (a != 1)
(lldb) si -c 10
Process 565440 stopped
* thread #1, name = 'a.out', stop reason = instruction step into
frame #0: 0x0000000000401197 a.out`main at small.c:11:3
8 c = a = (b == 0 || 1 % b);
9 if (a != 1)
10 abort();
-> 11 return 0;
12 }
(lldb)
$ cat small.c
#include <stdlib.h>
int a, b, c, d[10];
int main() {
for (int e=0; e<10; e++)
d[e] = 1;
if (d[0])
c = a = (b == 0 || 1 % b);
if (a != 1)
abort();
return 0;
}
--- Comment #1 from Yibiao Yang (杨已彪) <yangyibiao at hust.edu.cn> ---
Created attachment 23535
--> https://bugs.llvm.org/attachment.cgi?id=23535&action=edit
the binary
--
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/20200527/bf4f46f6/attachment.html>
More information about the llvm-bugs
mailing list