Closed
Description
Testcase:
int printf(const char *, ...);
int a, c = 1;
int b[2];
int main() {
d:
for (; a < 8; a += 1) {
int *e = &c;
if (&b[1] == e)
*e = 0;
}
f:
if (0) {
goto f;
goto d;
}
printf("%d\n", c);
}
The condition if (&b[1] == e)
should never be true.
Commands:
> /scratch/tc-testing/tc-mar-4-llvm/build/bin/clang -march=rv64gcv -O2 red.c -o red.out -fno-strict-aliasing
> /scratch/tc-testing/tc-mar-4-llvm/build/bin/qemu-riscv64 red.out
0
> /scratch/tc-testing/tc-mar-4-llvm/build/bin/clang red.c -o red.out -fno-strict-aliasing
> /scratch/tc-testing/tc-mar-4-llvm/build/bin/qemu-riscv64 red.out
1
Godbolt: https://godbolt.org/z/eEfqjf5rr
-opt-bisect-limit
points at InstCombinePass
Discovered/tested using version 57592e9 (not bisected)
Found using fuzzer