- Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
| Bugzilla Link | 42833 |
| Resolution | FIXED |
| Resolved on | Aug 20, 2019 03:10 |
| Version | trunk |
| OS | Linux |
| Blocks | #41819 |
| CC | @dbabokin,@topperc,@zmodem,@RKSimon,@regehr,@rotateright,@Vsevolod-Livinskij |
| Fixed by commit(s) | r367412,r367429 |
Extended Description
Clang produces incorrect result with -O3 -march=skx
Reproducer:
#include <stdio.h>
int b;
unsigned c[49];
int d[49];
void i() {
for (int g = 32; g <= 48; g++) {
d[g] -= c[g] + b;
c[g] += c[g] + b;
b -= b;
}
}
int main() {
for (int g = 0; g < 49; ++g)
c[g] = 3;
i();
printf("%d\n", d[36]);
}
Error:
$ clang -O3 -march=skx small.c ; ./a.out
0
$ clang -O0 -march=skx small.c ; ./a.out
-3
LLVM version:
clang version 10.0.0 (trunk 367162)
Target: x86_64-unknown-linux-gnu
Thread model: posix