[llvm-bugs] [Bug 51510] New: Wrong mapping assembly-line at Og
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 17 08:23:12 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51510
Bug ID: 51510
Summary: Wrong mapping assembly-line 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:
Line 14 is wrongly assigned to a xorl operation.
Steps to reproduce bug:
root at 52f3e2c061bc:/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 52f3e2c061bc:/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 52f3e2c061bc:/home/stepping/output# cat a.c
static int a, h;
char b, g;
static volatile int c;
static short d;
static char *e = &b;
int f;
int j;
int k[2];
int l;
int o() {
int q, i = 0;
char l_38[8];
for (; i < 8; i++)
l_38[i] = 0xBA;
q = 0;
for (; q <= 7; q++)
if (l_38[q])
a++;
return h;
}
char r() {
m:
*e = c;
{
int n = o();
d = 5;
for (; d <= 4; d = s()) {
short p;
if (2 | p) {
if (t())
return;
for (; f; f++)
;
} else
goto m;
if (l)
break;
}
}
}
int main() {
for (;;) {
r();
k[j] = 1;
if (k[0])
break;
e = g;
for (;;)
;
}
}
root at 52f3e2c061bc:/home/stepping/output# cat -n a.c
1 static int a, h;
2 char b, g;
3 static volatile int c;
4 static short d;
5 static char *e = &b;
6 int f;
7 int j;
8 int k[2];
9 int l;
10 int o() {
11 int q, i = 0;
12 char l_38[8];
13 for (; i < 8; i++)
14 l_38[i] = 0xBA;
15 q = 0;
16 for (; q <= 7; q++)
17 if (l_38[q])
18 a++;
19 return h;
20 }
21 char r() {
22 m:
23 *e = c;
24 {
25 int n = o();
26 d = 5;
27 for (; d <= 4; d = s()) {
28 short p;
29 if (2 | p) {
30 if (t())
31 return;
32 for (; f; f++)
33 ;
34 } else
35 goto m;
36 if (l)
37 break;
38 }
39 }
40 }
41 int main() {
42 for (;;) {
43 r();
44 k[j] = 1;
45 if (k[0])
46 break;
47 e = g;
48 for (;;)
49 ;
50 }
51 }
root at 52f3e2c061bc:/home/stepping/output# clang -Og -g -Wno-everything -o opt
a.c
root at 52f3e2c061bc:/home/stepping/output# lldb opt
(lldb) target create "opt"
Current executable set to '/home/stepping/output/opt' (x86_64).
(lldb) b 14
Breakpoint 1: 3 locations.
(lldb) r
Process 26 launched: '/home/stepping/output/opt' (x86_64)
Process 26 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.3
frame #0: 0x0000000000400517 opt`main [inlined] o at a.c:14:13
11 int q, i = 0;
12 char l_38[8];
13 for (; i < 8; i++)
-> 14 l_38[i] = 0xBA;
15 q = 0;
16 for (; q <= 7; q++)
17 if (l_38[q])
(lldb) di -l
opt`main:
-> 0x400517 <+23>: movq %rdx, -0x8(%rsp)
0x40051c <+28>: xorl %edx, %edx
(lldb) si
Process 26 stopped
* thread #1, name = 'opt', stop reason = instruction step into
frame #0: 0x000000000040051c opt`main [inlined] o at a.c:14:13
11 int q, i = 0;
12 char l_38[8];
13 for (; i < 8; i++)
-> 14 l_38[i] = 0xBA;
15 q = 0;
16 for (; q <= 7; q++)
17 if (l_38[q])
(lldb) di -l
opt`main:
0x400517 <+23>: movq %rdx, -0x8(%rsp)
-> 0x40051c <+28>: xorl %edx, %edx
--
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/20210817/c28105ef/attachment-0001.html>
More information about the llvm-bugs
mailing list