<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=46074">46074</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 8 should not be hit.
$ cat a.c
typedef int int32_t;
int a, b, c;
static int32_t d;
static char e;
char(f)(char g) { return g >> a; }
int main() {
for (; d < 9; ++d) {
int32_t l_273[2][4][1];
c = 0;
for (; c < 4; c++)
l_273[0][c][0] = 0;
b = f(e--);
l_273[0][3][0] |= b;
}
}
$ 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
$ clang -Og -g -o opt a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b main
Breakpoint 1: where = opt`main + 7 at a.c:7:3, address = 0x0000000000400497
(lldb) r
Process 65 launched: 'opt' (x86_64)
Process 65 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x0000000000400497 opt`main at a.c:7:3
4 static char e;
5 char(f)(char g) { return g >> a; }
6 int main() {
-> 7 for (; d < 9; ++d) {
8 int32_t l_273[2][4][1];
9 c = 0;
10 for (; c < 4; c++)
(lldb) s
Process 65 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x00000000004004b0 opt`main at a.c:8:5
5 char(f)(char g) { return g >> a; }
6 int main() {
7 for (; d < 9; ++d) {
-> 8 int32_t l_273[2][4][1];
9 c = 0;
10 for (; c < 4; c++)
11 l_273[0][c][0] = 0;
(lldb) di
opt`main:
0x400490 <+0>: pushq %r14
0x400492 <+2>: pushq %rbx
0x400493 <+3>: subq $0x28, %rsp
0x400497 <+7>: cmpb $0x0, 0x200b92(%rip) ; a + 3
0x40049e <+14>: jne 0x4004ef ; <+95> at a.c:15:1
0x4004a0 <+16>: movzbl 0x200b90(%rip), %r14d ; e
0x4004a8 <+24>: xorl %ebx, %ebx
0x4004aa <+26>: nopw (%rax,%rax)
-> 0x4004b0 <+32>: leal (%r14,%rbx), %eax
0x4004b4 <+36>: xorps %xmm0, %xmm0
0x4004b7 <+39>: movaps %xmm0, (%rsp)
0x4004bb <+43>: movl $0x4, 0x200b6f(%rip) ; d
0x4004c5 <+53>: movsbl %al, %edi
0x4004c8 <+56>: callq 0x400480 ; f at a.c:5
0x4004cd <+61>: movsbl %al, %eax
0x4004d0 <+64>: movl %eax, 0x200b66(%rip) ; b
0x4004d6 <+70>: addl $-0x1, %ebx
0x4004d9 <+73>: cmpl $-0x9, %ebx
0x4004dc <+76>: jne 0x4004b0 ; <+32> at a.c:8:5
0x4004de <+78>: addl %ebx, %r14d
0x4004e1 <+81>: movb %r14b, 0x200b50(%rip) ; e
0x4004e8 <+88>: movb $0x1, 0x200b41(%rip) ; a + 3
0x4004ef <+95>: xorl %eax, %eax
0x4004f1 <+97>: addq $0x28, %rsp
0x4004f5 <+101>: popq %rbx
0x4004f6 <+102>: popq %r14
0x4004f8 <+104>: retq
(lldb) s
Process 65 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x00000000004004b4 opt`main at a.c:11:22
8 int32_t l_273[2][4][1];
9 c = 0;
10 for (; c < 4; c++)
-> 11 l_273[0][c][0] = 0;
12 b = f(e--);
13 l_273[0][3][0] |= b;
14 }
(lldb) s
Process 65 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x00000000004004c5 opt`main at a.c:12:9
9 c = 0;
10 for (; c < 4; c++)
11 l_273[0][c][0] = 0;
-> 12 b = f(e--);
13 l_273[0][3][0] |= b;
14 }
15 }</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>