https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126618
Bug ID: 126618
Summary: riscv rvv: Runtime crash in x265 library
Product: gcc
Version: 16.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: joel at jms dot id.au
CC: anton at ozlabs dot org, bergner at gcc dot gnu.org,
law at gcc dot gnu.org, majin at gcc dot gnu.org, rdapp at
gcc dot gnu.org
Target Milestone: ---
Target: riscv64-*-linux-gnu
Created attachment 65222
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65222&action=edit
reproducer for the bug
x265 crashes with a segfault at pc=0x140 on the Spacemit K3 when encoding.
The RVV backend in the library is built with -O2 -fPIC -match=rv64gcv.
The bug appears with the gcc 15 and gcc 16 branches, but not trunk. It was
fixed by https://gcc.gnu.org/cgit/gcc/commit/?id=bfc82936d1ea "RISC-V: Exclude
t1 from SIBCALL_REGS" which backports cleanly to both branches.
Attached is a generated reproducer that I used to discover that trunk was
fixed, and confirmed the backported fix worked. Running it under qemu shows the
segfault follows vlen * 8:
$ QEMU_GDB=1234 qemu-riscv64 -cpu max,vlen=128 ./repro
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000080 in ?? ()
$ QEMU_GDB=1234 qemu-riscv64 -cpu max,vlen=256 ./repro
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000100 in ?? ()