<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=46008">46008</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>ditaliano@apple.com, jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>Line 7 should not be hit.
$ cat a.c
short a = 1;
int b, c;
void(d)() {}
int main() {
int *p_5 = &c;
for (; a <= 0; a = d)
if ((*p_5))
break;
b = *p_5;
}
$ clang -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
268fa40daa151d3b4bff1df12b62e5dae94685d7)
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
$ lldb -v
lldb version 11.0.0
clang revision 268fa40daa151d3b4bff1df12b62e5dae94685d7
llvm revision 268fa40daa151d3b4bff1df12b62e5dae94685d7
$ lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main at a.c:6:12, address = 0x0000000000400490
(lldb) r
Process 334 launched: '/home/stepping/output/opt' (x86_64)
Process 334 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x0000000000400490 opt`main at a.c:6:12
3 void(d)() {}
4 int main() {
5 int *p_5 = &c;
-> 6 for (; a <= 0; a = d)
7 if ((*p_5))
8 break;
9 b = *p_5;
(lldb) p a
(short) $0 = 1
(lldb) s
Process 334 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x0000000000400498 opt`main at a.c:7:10
4 int main() {
5 int *p_5 = &c;
6 for (; a <= 0; a = d)
-> 7 if ((*p_5))
8 break;
9 b = *p_5;
10 }
(lldb) di
opt`main:
0x400490 <+0>: cmpw $0x0, 0x200b90(%rip) ; __dso_handle + 5
-> 0x400498 <+8>: movl 0x200b92(%rip), %eax ; opt.PT_LOAD[1]..bss + 4
0x40049e <+14>: jg 0x4004c1 ; <+49> at a.c:9:5
0x4004a0 <+16>: testl %eax, %eax
0x4004a2 <+18>: jne 0x4004c1 ; <+49> at a.c:9:5
0x4004a4 <+20>: movl $0x400480, %ecx ; imm = 0x400480
0x4004a9 <+25>: nopl (%rax)
0x4004b0 <+32>: testw %cx, %cx
0x4004b3 <+35>: jle 0x4004b0 ; <+32> at a.c:6:3
0x4004b5 <+37>: movl $0x400480, %ecx ; imm = 0x400480
0x4004ba <+42>: movw %cx, 0x200b67(%rip) ; __dso_handle + 6
0x4004c1 <+49>: movl %eax, 0x200b6d(%rip) ; b
0x4004c7 <+55>: xorl %eax, %eax
0x4004c9 <+57>: retq
(lldb) s
Process 334 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x000000000040049e opt`main at a.c:6:3
3 void(d)() {}
4 int main() {
5 int *p_5 = &c;
-> 6 for (; a <= 0; a = d)
7 if ((*p_5))
8 break;
9 b = *p_5;
(lldb) s
Process 334 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x00000000004004c1 opt`main at a.c:9:5
6 for (; a <= 0; a = d)
7 if ((*p_5))
8 break;
-> 9 b = *p_5;
10 }
(lldb)
$ gdb opt
(gdb) b main
Breakpoint 1 at 0x400490: file a.c, line 6.
(gdb) r
Starting program: opt
Breakpoint 1, main () at a.c:6
6 for (; a <= 0; a = d)
(gdb) s
7 if ((*p_5))
(gdb) s
6 for (; a <= 0; a = d)
(gdb) s
9 b = *p_5;
(gdb)</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>