[Bug target/126618] New: riscv rvv: Runtime crash in x265 library

"joel at jms dot id.au via Gcc-bugs" <[email protected]> Mon, 03 Aug 2026 14:10:36 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126618

            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=3D65222&action=3Dedit
reproducer for the bug

x265 crashes with a segfault at pc=3D0x140 on the Spacemit K3 when encoding.

The RVV backend in the library is built with -O2 -fPIC -match=3Drv64gcv.

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=3Dbfc82936d1ea "RISC-V: Ex=
clude
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=3D1234 qemu-riscv64 -cpu max,vlen=3D128 ./repro

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000080 in ?? ()

$ QEMU_GDB=3D1234 qemu-riscv64 -cpu max,vlen=3D256 ./repro

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000100 in ?? ()=