<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED DUPLICATE - inconsistent behaviors at -O1"
href="https://bugs.llvm.org/show_bug.cgi?id=46046">46046</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>inconsistent behaviors at -O1
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>RESOLVED
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yangyibiao@hust.edu.cn
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Status</th>
<td>RESOLVED
</td>
</tr>
<tr>
<th>Resolution</th>
<td>DUPLICATE
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED DUPLICATE - inconsistent behaviors at -O1"
href="https://bugs.llvm.org/show_bug.cgi?id=46046#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED DUPLICATE - inconsistent behaviors at -O1"
href="https://bugs.llvm.org/show_bug.cgi?id=46046">bug 46046</a>
from <span class="vcard"><a class="email" href="mailto:yangyibiao@hust.edu.cn" title="Yibiao Yang (杨已彪) <yangyibiao@hust.edu.cn>"> <span class="fn">Yibiao Yang (杨已彪)</span></a>
</span></b>
<pre>
*** This bug has been marked as a duplicate of <a class="bz_bug_link
bz_status_NEW "
title="NEW - inconsistent behaviors at -O1"
href="show_bug.cgi?id=46045">bug 46045</a> ***</pre>
</div>
<div>
<pre>$ 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 -O1 -g small.c
$ lldb a.out
(lldb) target create "a.out"
Current executable set to '/home/yibiao/Debugger/a.out' (x86_64).
(lldb) b 22
Breakpoint 1: where = a.out`foo + 37 at small.c:22:3, address =
0x0000000000401135
(lldb) r
Process 367418 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 367418 exited with status = 0 (0x00000000)
(lldb)
/*********************************************
As showed above, when setting breakpoint at Line 22, lldb wrongly exit
directly.
Line 22 is actually executed in step-i as follow:
*********************************************/
$ 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:26:3, address =
0x0000000000401151
(lldb) r
Process 367312 launched: '/home/yibiao/Debugger/a.out' (x86_64)
Process 367312 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x0000000000401151 a.out`main at small.c:26:3
23 }
24
25 int main() {
-> 26 foo();
27 return 0;
28 }
(lldb) si -c 9
Process 367312 stopped
* thread #1, name = 'a.out', stop reason = instruction step into
frame #0: 0x000000000040113f a.out`foo at small.c:22:3
19 if (pn->p==(void *)ph)
20 ph->f = &nd;
21
-> 22 return 0;
23 }
24
25 int main() {
(lldb)
$ cat small.c
struct sn {
struct sn *n;
struct sn *p;
} nd;
struct sh {
struct sn *f;
} hs[2];
struct sh *h=&hs[0];
int foo() {
nd.p = (void*)h;
h->f = &nd;
struct sn *pn=h->f;
struct sh *ph=h;
if (pn->p==(void *)ph)
ph->f = &nd;
return 0;
}
int main() {
foo();
return 0;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>