https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116655
Bug ID: 116655
Summary: RISC-V: ICE with -mrvv-max-lmul=dynamic in
compute_nregs_for_mode
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: patrick at rivosinc dot com
Target Milestone: ---
Testcase:
short a[5];
int b() {
int c = 0;
for (; c <= 4; c++)
if (a[c])
break;
return c;
}
Command:
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
> -O3 -march=rv64imv -mrvv-max-lmul=dynamic preprocessed.c -c -S -o /dev/null
during GIMPLE pass: vect
preprocessed.c: In function 'b':
preprocessed.c:2:5: internal compiler error: in compute_nregs_for_mode, at
config/riscv/riscv-vector-costs.cc:457
2 | int b() {
| ^
0x2e23485 internal_error(char const*, ...)
../../../gcc/gcc/diagnostic-global-context.cc:492
0xc51306 fancy_abort(char const*, int, char const*)
../../../gcc/gcc/diagnostic.cc:1658
0xb8bde2 compute_nregs_for_mode
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:457
0xb8bde2 max_number_of_live_regs
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:496
0xb8bde2 has_unexpected_spills_p
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:845
0x1893d06
riscv_vector::costs::record_potential_unexpected_spills(_loop_vec_info*)
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:909
0x1893d06
riscv_vector::costs::record_potential_unexpected_spills(_loop_vec_info*)
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:897
0x18943fa riscv_vector::costs::analyze_loop_vinfo(_loop_vec_info*)
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:891
0x18943fa riscv_vector::costs::add_stmt_cost(int, vect_cost_for_stmt,
_stmt_vec_info*, _slp_tree*, tree_node*, int, vect_cost_model_location)
../../../gcc/gcc/config/riscv/riscv-vector-costs.cc:1234
0x16c4663 add_stmt_cost(vector_costs*, int, vect_cost_for_stmt,
_stmt_vec_info*, _slp_tree*, tree_node*, int, vect_cost_model_location)
../../../gcc/gcc/tree-vectorizer.h:1894
0x16c4663 add_stmt_costs(vector_costs*, vec<stmt_info_for_cost, va_heap,
vl_ptr>*)
../../../gcc/gcc/tree-vectorizer.h:1941
0x16c4663 vect_slp_analyze_operations(vec_info*)
../../../gcc/gcc/tree-vect-slp.cc:8000
0x168a7bb vect_analyze_loop_2
../../../gcc/gcc/tree-vect-loop.cc:2954
0x168c570 vect_analyze_loop_1
../../../gcc/gcc/tree-vect-loop.cc:3409
0x168cd09 vect_analyze_loop(loop*, vec_info_shared*)
../../../gcc/gcc/tree-vect-loop.cc:3567
0x16d9c54 try_vectorize_loop_1
../../../gcc/gcc/tree-vectorizer.cc:1068
0x16d9c54 try_vectorize_loop
../../../gcc/gcc/tree-vectorizer.cc:1184
0x16da57c execute
../../../gcc/gcc/tree-vectorizer.cc:1300
Godbolt: https://godbolt.org/z/fneanToPK
Found via fuzzer.