[llvm-bugs] [Bug 51771] New: Variable not visible and Wrong asm source mapping at Og
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 6 13:52:15 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51771
Bug ID: 51771
Summary: Variable not visible and Wrong asm source mapping at
Og
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: artuso at diag.uniroma1.it
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
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 at 15b8141e5126:/home/stepping/output# clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
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 at 15b8141e5126:/home/stepping/output# lldb -v
lldb version 14.0.0 (https://github.com/llvm/llvm-project.git revision
957334382cd12ec07b46c0ddfdcc220731f6d80f)
clang revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
llvm revision 957334382cd12ec07b46c0ddfdcc220731f6d80f
root at 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 at 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 at 15b8141e5126:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c
root at 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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210906/c6191cb3/attachment-0001.html>
More information about the llvm-bugs
mailing list