<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 Information at O3"
href="https://bugs.llvm.org/show_bug.cgi?id=45902">45902</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong Debug Information at O3
</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>Windows NT
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.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, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Debug information seems wrong at O3.
At line 7 variable j and k should not be visible.
$ cat a.c
int a[56];
int b ;
int c[1] ;
int d[1][9][8] ;
void
e (f) {
b =
b & 5 ^
a[b ^ f ];
}
void h (f) {
long g = f;
{
b = b & 5 ^ a[b ];
b = b & 5 ^ a[b ^ 8 ];
b = b & 5 ^ a[b ^ g ];
b = b & 5 ^ a[b ^ g ];
}
e (g & 5);
e (g>>48 & 5);
e (g>>56 & 5);
}
int main ()
{
int i, j, k, dm ;
{
d[0][1][0] = 0;
}
printf("ciao");
h(0);
j = 0;
for (; j < 9; j++)
{
k = 0;
for (; k < 8; k++)
h(d[0][j][k]);
}
}
$ clang -v
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
c25b20c0f6c13d68dbc2e185764082d61ae4a132)
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
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ lldb -v
lldb version 11.0.0
clang revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
llvm revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
$ clang -O3 -g -o opt a.c
$ lldb opt
(lldb) target create "opt"
Current executable set to 'opt' (x86_64).
(lldb) b -l 7
Breakpoint 1: 3 locations.
(lldb) r
Process 60 launched: 'opt' (x86_64)
Process 60 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.3
frame #0: 0x0000000000400618 opt`main [inlined] e(f=0) at a.c:7:4
4 int d[1][9][8] ;
5 void
6 e (f) {
-> 7 b =
8 b & 5 ^
9 a[b ^ f ];
10 }
(lldb) frame var
(int) f = 0
(lldb) s
Process 60 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x000000000040061e opt`main at a.c:7:4
4 int d[1][9][8] ;
5 void
6 e (f) {
-> 7 b =
8 b & 5 ^
9 a[b ^ f ];
10 }
(lldb) frame var
(int) j = 0
(int) k = 0
(int) i = <no location, value may have been optimized out>
(int) dm = <no location, value may have been optimized out>
(lldb)
$ gdb opt
Breakpoint 1, e (f=0) at a.c:7
7 b =
(gdb) frame var
#0 e (f=0) at a.c:7
7 b =
(gdb) bt
#0 e (f=0) at a.c:7
#1 h (f=0) at a.c:22
#2 main () at a.c:32
(gdb) s
main () at a.c:38
38 h(d[0][j][k]);
(gdb) frame var
#0 main () at a.c:38
38 h(d[0][j][k]);
(gdb) c
Continuing.
ciao[Inferior 1 (process 153) exited normally]
(gdb)</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>