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

            Bug ID: 113796
           Summary: [14] RISC-V rv64gcv vector: Runtime mismatch at -O2
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
signed char a[] = {0x80, 0};
int b;
signed char c;

int main() {
  for (; b < 1; b += 1)
      c = a[b] < 0 ?: a[b] >> 6;

  if (c == 1)
    return 0;
  else
    return 1;
}

Commands:
> /scratch/tc-testing/tc-feb-6/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc 
> -march=rv64gcv -O2 red.c -o user-config.out
> QEMU_CPU=rv64,vlen=128,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true 
> /scratch/tc-testing/tc-feb-6/build-rv64gcv/bin/qemu-riscv64 user-config.out
> echo $?
1

> /scratch/tc-testing/tc-feb-6/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc 
> -march=rv64gcv -O1 red.c -o user-config.out
> QEMU_CPU=rv64,vlen=128,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true 
> /scratch/tc-testing/tc-feb-6/build-rv64gcv/bin/qemu-riscv64 user-config.out
> echo $?
0

Godbolt:
https://godbolt.org/z/c7xrqx7Kz

Tested using r14-8834-gdb5c3f6d952 (not bisected).

Found using fuzzer.

Reply via email to