https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115669
Bug ID: 115669
Summary: [15 Regression] rv64gcv -fwrapv miscompile since
r15-1006-gd93353e6423
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: patrick at rivosinc dot com
Target Milestone: ---
Testcase:
int a = 10;
unsigned b;
long long c[100];
int main() {
long long *d = c;
for (short e = 0; e < a; e++)
b += ~(d ? d[e] : 0);
__builtin_printf("%d\n", b);
}
Commands:
>
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
> red.c -march=rv64gcv -O3 -o red.out -fwrapv
> QEMU_CPU=rv64,vlen=256,v=true,vext_spec=v1.0,zve32f=true,zve64f=true timeout
> --verbose -k 0.1 4
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/qemu-riscv64 red.out
-8
>
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
> red.c -march=rv64gcv -O2 -o red.out -fwrapv
> QEMU_CPU=rv64,vlen=256,v=true,vext_spec=v1.0,zve32f=true,zve64f=true timeout
> --verbose -k 0.1 4
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/qemu-riscv64 red.out
-10
First bad commit: r15-1006-gd93353e6423
Found via fuzzer but Vineet bisected the 502.gcc_r benchmark breakage in
spec2017 for the riscv target to the same commit so this _might_ be the same
issue.