https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111947
Bug ID: 111947
Summary: RISC-V vector: RTL Check: expected code 'reg', have
'const_int' in rhs_regno, at rtl.h:1934
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: ---
Created attachment 56184
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56184&action=edit
-freport-bug output
Ran into an ICE with glibc with rtl checking enabled.
Bisected to/caused by commit: r14-4773-g29331e72d0c
during RTL pass: vsetvl
inet_ntop.c: In function 'inet_ntop':
inet_ntop.c:65:1: internal compiler error: RTL check: expected code 'reg', have
'const_int' in rhs_regno, at rtl.h:1934
65 | }
| ^
0x961683 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int,
char const*)
../../../gcc/gcc/rtl.cc:770
0x99934c rhs_regno(rtx_def const*)
../../../gcc/gcc/rtl.h:1934
0x999dec rhs_regno(rtx_def const*)
../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:2628
0x999dec pre_vsetvl::compute_lcm_local_properties()
../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:2695
0x1734a89 pre_vsetvl::earliest_fuse_vsetvl_info()
../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:2885
0x1735e29 pass_vsetvl::lazy_vsetvl()
../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:3524
0x17361b7 pass_vsetvl::execute(function*)
../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:3571
0x17361b7 pass_vsetvl::execute(function*)
../../../gcc/gcc/config/riscv/riscv-vsetvl.cc:3554
Reduced testcase from a glibc build failure:
char *a;
b() {
int c[2];
int d = 0;
for (; d < 16; d += 2)
c[d / 2] = a[d | 1];
if (c[0])
for (;;)
;
}