<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 line information at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=47239">47239</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong line information at Og
</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>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>massarelli@diag.uniroma1.it
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>After setting a breakpoint at func_10 and running line 5 is hit. However, from
disassembly, it seems that line 7 is being executed.
$ cat -n a.c
1 int a;
2 int *b;
3 int *func_10() {
4 int *c = &a;
5 int i, j;
6 d:
7 if (*c)
8 goto d;
9 i = 0;
10 for (; i;)
11 j = &c;
12 return c;
13 }
14 int main() { b = func_10(); }
$ cat a.c
int a;
int *b;
int *func_10() {
int *c = &a;
int i, j;
d:
if (*c)
goto d;
i = 0;
for (; i;)
j = &c;
return c;
}
int main() { b = func_10(); }
$ clang -v
clang version 12.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
bc8be3054067ac822fc6d9f4f8e64c841f530f16)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ clang -Og -g -o opt a.c
$ lldb opt
lldb opt
(lldb) target create "opt"
Current executable set to opt' (x86_64).
(lldb) b func_10
Breakpoint 1: where = opt`func_10 + 7 at a.c:5:3, address = 0x0000000000400487
(lldb) r
Process 24746 launched: 'opt' (x86_64)
Process 24746 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x0000000000400487 opt`func_10 at a.c:5:3
2 int *b;
3 int *func_10() {
4 int *c = &a;
-> 5 int i, j;
6 d:
7 if (*c)
8 goto d;
(lldb) di
opt`func_10:
0x400480 <+0>: cmpl $0x0, 0x200ba9(%rip) ; opt.PT_LOAD[1]..bss + 7
-> 0x400487 <+7>: je 0x400492 ; <+18> at a.c:12:3
0x400489 <+9>: nopl (%rax)
0x400490 <+16>: jmp 0x400490 ; <+16> at a.c:7:7
0x400492 <+18>: movl $0x601030, %eax ; imm = 0x601030
0x400497 <+23>: retq
(lldb)</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>