<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 - Variable not visible and Wrong asm source mapping at Og"
href="https://bugs.llvm.org/show_bug.cgi?id=51771">51771</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Variable not visible and Wrong asm source mapping 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>artuso@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>Comment:
When Stepping on line 32 "if (g_412)", the value of the variable g_412 is not
visible. Moreover, the associated assembly instructions are wrong. The "movb
$0x1, 0x200a5a(%rip)" assembly instruction should probably be associated to
line 33 where the variable ar is set to one.
Steps to reproduce bug:
root@15b8141e5126:/home/stepping/output# clang -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
957334382cd12ec07b46c0ddfdcc220731f6d80f)
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
root@15b8141e5126:/home/stepping/output# lldb -v
lldb version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a> revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
root@15b8141e5126:/home/stepping/output# cat a.c
volatile int a, ae;
static int b = 6;
int c;
int d;
short e, f, g, i, l, n, p, at;
int h;
static unsigned g_412 = 7;
int j;
int k;
int m;
char o, q;
unsigned aa;
char ao[3][1];
int ap;
unsigned char ag(void);
static short func_1() {
int ar;
for (; ap < 3; ap++)
ao[ap][0] = 1;
b = 0;
for (; b >= 0; b--) {
char as;
c = 0;
if (ao[1][b]) {
o = j = f = l = i = o = d = e = n = m = h = i = p = d = h = j = d = j =
aa = e = g = 0;
ag();
ar = 0;
}
for (; b;)
g_412 = 0;
if (g_412)
return ar = k >= ar;
c = p;
}
o = 0;
}
unsigned char ag() {
if (ae) {
if (p) {
(l = 0) <= q && (p = at);
return;
}
k = 0;
}
}
int main() {
func_1();
a = b;
a = p;
}
root@15b8141e5126:/home/stepping/output# cat -n a.c
1 volatile int a, ae;
2 static int b = 6;
3 int c;
4 int d;
5 short e, f, g, i, l, n, p, at;
6 int h;
7 static unsigned g_412 = 7;
8 int j;
9 int k;
10 int m;
11 char o, q;
12 unsigned aa;
13 char ao[3][1];
14 int ap;
15 unsigned char ag(void);
16 static short func_1() {
17 int ar;
18 for (; ap < 3; ap++)
19 ao[ap][0] = 1;
20 b = 0;
21 for (; b >= 0; b--) {
22 char as;
23 c = 0;
24 if (ao[1][b]) {
25 o = j = f = l = i = o = d = e = n = m = h = i = p = d = h = j = d
= j =
26 aa = e = g = 0;
27 ag();
28 ar = 0;
29 }
30 for (; b;)
31 g_412 = 0;
32 if (g_412)
33 return ar = k >= ar;
34 c = p;
35 }
36 o = 0;
37 }
38 unsigned char ag() {
39 if (ae) {
40 if (p) {
41 (l = 0) <= q && (p = at);
42 return;
43 }
44 k = 0;
45 }
46 }
47 int main() {
48 func_1();
49 a = b;
50 a = p;
51 }
root@15b8141e5126:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c
root@15b8141e5126:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b 32
Breakpoint 1: where = opt`main + 204 [inlined] func_1 + 203 at a.c:32:9,
address = 0x00000000004005dc
(lldb) r
Process 28734 launched: '/home/stepping/output/opt' (x86_64)
Process 28734 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x00000000004005dc opt`main [inlined] func_1 at a.c:32:9
29 }
30 for (; b;)
31 g_412 = 0;
-> 32 if (g_412)
33 return ar = k >= ar;
34 c = p;
35 }
(lldb) p g_412
error: expression failed to parse:
error: <user expression 4>:1:1: use of undeclared identifier 'g_412'
(lldb) di -l
opt`main:
-> 0x4005dc <+204>: movswl 0x200a55(%rip), %eax ; p
0x4005e3 <+211>: movb $0x1, 0x200a5a(%rip) ; k + 3
(lldb) si di -l
error: unknown or ambiguous option
(lldb) si
Process 28734 stopped
* thread #1, name = 'opt', stop reason = instruction step into
frame #0: 0x00000000004005e3 opt`main [inlined] func_1 at a.c:32:9
29 }
30 for (; b;)
31 g_412 = 0;
-> 32 if (g_412)
33 return ar = k >= ar;
34 c = p;
35 }
(lldb) di -l
opt`main:
0x4005dc <+204>: movswl 0x200a55(%rip), %eax ; p
-> 0x4005e3 <+211>: movb $0x1, 0x200a5a(%rip) ; k + 3</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>