<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_NEW "
title="NEW - Wrong debug info generated at -O1 (-O0 is correct)"
href="https://bugs.llvm.org/show_bug.cgi?id=40836">40836</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong debug info generated at -O1 (-O0 is correct)
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Keywords</th>
<td>wrong-debug
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>davide@freebsd.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ cat outer.c
void optimize_me_not() {}
$ cat 3.c
int b;
char c;
int(a)() { return b; }
char d(p_21) {
e : {
int f;
p_21;
if (a())
;
else {
optimize_me_not();
return 1;
}
for (; c;) {
p_21 = 0;
goto e;
}
}
}
int main() { d(8); }
### -O0
$ lldb-trunk ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`d + 30 at 3.c:11:5, address = 0x00000000004004ae
(lldb) r
Process 10883 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 10883 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00000000004004ae a.out`d(p_21=8) at 3.c:11:5
8 if (a())
9 ;
10 else {
-> 11 optimize_me_not();
12 return 1;
13 }
14 for (; c;) {
(lldb) p p_21
(int) $0 = 8
### -O1
(lldb) br set -p optimize_me_not
Breakpoint 1: where = a.out`d + 34 at 3.c:11:5, address = 0x00000000004004b2
(lldb) r
Process 8803 launched: '/home/davide/finished_reducing/a.out' (x86_64)
Process 8803 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00000000004004b2 a.out`d(p_21=0) at 3.c:11:5
8 if (a())
9 ;
10 else {
-> 11 optimize_me_not();
12 return 1;
13 }
14 for (; c;) {
(lldb) p p_21
(int) $0 = 0</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>