| Issue |
162512
|
| Summary |
[RISC-V] Miscompile at -O3
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ewlu
|
Testcase:
```c
int a;
long long ad;
int w[14];
_Bool x[14];
unsigned short b[14][14][14][14];
void c(int w[], _Bool x[]) {
for (short y = 0; y < 014; y++)
for (_Bool z = 0; z < 1; z = 1) {
for (int aa = 1; aa < x[10] + 2; aa++)
b[y][y][z][a] = 0;
for (int ab = 1; ab < x[10] + 12; ab++)
a -= w[ab];
}
}
int main() {
for (int y = 0; y < 4; ++y)
for (int ag = 0; ag < 4; ++ag)
for (int ah = 0; ah < 4; ++ah)
for (int ai = 0; ai < 4; ++ai)
b[y][ag][ah][ai] = 040;
c(w, x);
for (int y = 0; y < 4;)
for (int ag = 0; ag < 4;)
for (int ah = 0; ah < 4;)
for (int ai; y < 4; ++y)
for (ag = 0; ag < 4; ++ag)
for (ah = 0; ah < 4; ++ah)
for (ai = 0; ai < 4; ++ai)
ad ^= b[y][ag][ah][ai];
__builtin_printf("%llu\n", ad);
}
```
Commands:
```
# -O3
$ /scratch/ewlu/daily-upstream-build/build-gcv/bin/clang -march=rv64gcv_zvl256b -O3 red.c -o user-config.out -fsigned-char -fno-strict-aliasing -fwrapv
$ QEMU_CPU=rv64,vlen=256,rvv_ta_all_1s=true,rvv_ma_all_1s=true,v=true,vext_spec=v1.0,zve32f=true,zve64f=true timeout --verbose -k 0.1 4 /scratch/ewlu/daily-upstream-build/build-gcv/bin/qemu-riscv64 user-config.out
32
# -O2
$ /scratch/ewlu/daily-upstream-build/build-gcv/bin/clang -march=rv64gcv_zvl256b -O2 red.c -o user-config.out -fsigned-char -fno-strict-aliasing -fwrapv
$ QEMU_CPU=rv64,vlen=256,rvv_ta_all_1s=true,rvv_ma_all_1s=true,v=true,vext_spec=v1.0,zve32f=true,zve64f=true timeout --verbose -k 0.1 4 /scratch/ewlu/daily-upstream-build/build-gcv/bin/qemu-riscv64 user-config.out
0
```
Found via fuzzer
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs