Issue |
134705
|
Summary |
[RISC-V] Miscompile in rv64gcv with -O3 -flto
|
Labels |
new issue
|
Assignees |
|
Reporter |
ewlu
|
Testcase:
```c
short a;
long long q;
short d = 22032;
char h = 88;
char k[25];
int main() {
for (int l = 0; l < 25; ++l)
k[l] = 9;
for (int l = 0; l < d - 22007; l += 4)
for (short m = 0; m < h - 63; m += 3)
a += k[m] != k[l];
q = a;
__builtin_printf("%llu\n", q);
}
```
Commands:
```
# riscv
$ /scratch/ewlu/daily-upstream-build/build-gcv/bin/clang -march=rv64gcv -flto -O3 red.c -o user-config.out
$ QEMU_CPU=rv64,vlen=128,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 1
9
$ /scratch/ewlu/daily-upstream-build/build-gcv/bin/clang -march=rv64gcv -flto -O2 red.c -o user-config.out
$ QEMU_CPU=rv64,vlen=128,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 1
0
# x86
$ ./native.out
0
```
Bisected to ff8f6abe20a9dfbb1de8d978f865092413d3416c as first bad commit.
Replacing `d - 22007` with `25` or `h - 63` with `25` prevents the error from occurring. `-flto` also appears to be mandatory here too
I don't know if this is could also be related to #134126? Both the commit messages seem to be lowering shuffles for vla code.
Found via fuzzer
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs