-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 51510 |
| Version | trunk |
| OS | Linux |
| CC | @JDevlieghere,@jmorse,@walkerkd,@pogo59 |
Extended Description
Comment:
Line 14 is wrongly assigned to a xorl operation.
Steps to reproduce bug:
root@52f3e2c061bc:/home/stepping/output# clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git 9573343)
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@52f3e2c061bc:/home/stepping/output# lldb -v
lldb version 14.0.0 (https://github.com/llvm/llvm-project.git revision 9573343)
clang revision 9573343
llvm revision 9573343
root@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@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@52f3e2c061bc:/home/stepping/output# clang -Og -g -Wno-everything -o opt a.c
root@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 optmain [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 optmain:
-> 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 optmain [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 optmain:
0x400517 <+23>: movq %rdx, -0x8(%rsp)
-> 0x40051c <+28>: xorl %edx, %edx