https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114733

            Bug ID: 114733
           Summary: [14] Miscompile with -march=rv64gcv -O3 on riscv
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
long b = 1;
signed char c;
int d[25];
int main() {
  for (signed char g = 0; g < 8; g += 1)
    for (short h = 0; h < 25; h += 2) {
      b *= -1;
      c ^= d[h];
    }
  __builtin_printf("%ld\n", b);
}

Commands:
> /scratch/tc-testing/tc-apr-15/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc 
> -march=rv64gcv -O3 red.c -o red.out
> /scratch/tc-testing/tc-apr-15/build-rv64gcv/bin/qemu-riscv64 red.out
-1
> /scratch/tc-testing/tc-apr-15/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc 
> red.c -o red.out
> /scratch/tc-testing/tc-apr-15/build-rv64gcv/bin/qemu-riscv64 red.out
1

This testcase looks extremely similar to pr114485 so they are likely related -
from my testing pr114485 has NOT regressed.

Tested using r14-9976-gf8409c3109d (not bisected)

Found via fuzzer.

Reply via email to