https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113586
Bug ID: 113586 Summary: ICE: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 with -march=rv32gcv -mabi=ilp32e Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: riscv64-unknown-linux-gnu Created attachment 57208 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57208&action=edit reduced testcase (from gcc.target/riscv/rvv/vsetvl/imm_switch-1.c) I have a strong feeling of reporting this before, but I can't find the original PR. Sorry for the dup, if I searched poorly. This probably needs RTL checking enabled. Compiler output: $ riscv64-unknown-linux-gnu-gcc -march=rv32gcv -mabi=ilp32e testcase.c during RTL pass: expand testcase.c: In function 'f_n': testcase.c:2:6: internal compiler error: RTL check: expected code 'const_int', have 'reg' in rtx_to_poly_int64, at rtl.h:2398 2 | void f_n() { | ^~~ 0xad3dd3 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*) /repo/gcc-trunk/gcc/rtl.cc:770 0x9fdf35 rtx_to_poly_int64(rtx_def const*) /repo/gcc-trunk/gcc/rtl.h:2398 0x9fdf35 rtx_to_poly_int64(rtx_def const*) /repo/gcc-trunk/gcc/rtl.h:2389 0x9fdf35 expand_stack_vars /repo/gcc-trunk/gcc/cfgexpand.cc:1328 0x1184673 expand_used_vars /repo/gcc-trunk/gcc/cfgexpand.cc:2417 0x1188b01 execute /repo/gcc-trunk/gcc/cfgexpand.cc:6708 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. $ riscv64-unknown-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-riscv64/bin/riscv64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-8383-20240124073818-g59004711660-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/14.0.1/lto-wrapper Target: riscv64-unknown-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --with-isa-spec=2.2 --with-sysroot=/usr/riscv64-unknown-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=riscv64-unknown-linux-gnu --with-ld=/usr/bin/riscv64-unknown-linux-gnu-ld --with-as=/usr/bin/riscv64-unknown-linux-gnu-as --disable-multilib --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r14-8383-20240124073818-g59004711660-checking-yes-rtl-df-extra-riscv64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.1 20240124 (experimental) (GCC)