https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123994
Bug ID: 123994
Summary: [16 Regression] RISC-V rv64gcb: ICE at -O2 during RTL
pass: late_combine
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: xxs_chy at outlook dot com
Target Milestone: ---
Reproducer: https://godbolt.org/z/d7ssTcvcM
Testcase:
#include <stdint.h>
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
uint8_t backsmith_snippet_141(int16_t, uint64_t);
int32_t backsmith_snippet_122(uint64_t BS_ARG_0, uint32_t BS_ARG_1)
{
BS_ARG_0 =
BS_ARG_1 ? (BS_VEC(uint64_t, 16)){}[BS_ARG_0] : 4054722019416799465;
return BS_ARG_0;
}
uint16_t backsmith_pure_0(uint64_t BS_ARG_2, uint32_t BS_ARG_3)
{
int64_t BS_VAR_0[6];
int8_t BS_VAR_3[80];
for (uint16_t BS_INC_0 = 0; BS_INC_0 < 8; BS_INC_0 += 1)
{
uint64_t BS_TEMP_590 = BS_INC_0;
BS_VAR_0[BS_INC_0] = BS_INC_0
? (BS_TEMP_590 ? BS_ARG_2 >> BS_TEMP_590 : 0)
?: backsmith_snippet_141(0, BS_INC_0)
: 0;
BS_VAR_3[BS_INC_0] =
backsmith_snippet_122(BS_VAR_0[6 ? (uint64_t)BS_INC_0 : 0] < 0,
BS_ARG_3)
?: BS_ARG_3;
}
if (BS_ARG_2) BS_VAR_3[BS_ARG_3 < 80 ? BS_ARG_3 : 0] = 0;
return BS_VAR_3[4];
}
Dump:
during RTL pass: late_combine
<source>: In function 'backsmith_pure_0':
<source>:28:1: internal compiler error: Segmentation fault
28 | }
| ^
0x75d3c8a29e3f __libc_start_main
???:0
/cefs/1c/1c2b2139204c683664f31877_riscv64_gcc-trunk-20260205/riscv64-unknown-linux-gnu/bin/../libexec/gcc/riscv64-unknown-linux-gnu/16.0.1/cc1
-quiet -imultilib . -iprefix
/cefs/1c/1c2b2139204c683664f31877_riscv64_gcc-trunk-20260205/riscv64-unknown-linux-gnu/bin/../lib/gcc/riscv64-unknown-linux-gnu/16.0.1/
-isysroot
/cefs/1c/1c2b2139204c683664f31877_riscv64_gcc-trunk-20260205/riscv64-unknown-linux-gnu/bin/../riscv64-unknown-linux-gnu/sysroot
<source> -quiet -dumpdir /app/ -dumpbase output.c -dumpbase-ext .c
-march=rv64gcb -mabi=lp64d -misa-spec=20191213 -mtls-dialect=trad
-march=rv64imafdcb_zicsr_zifencei_zmmul_zaamo_zalrsc_zca_zcd_zba_zbb_zbs -g -O2
-w -fdiagnostics-color=always -fno-verbose-asm -o /app/output.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1