https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117877
Bug ID: 117877
Summary: [RISC-V][14/15 Regression] internal compiler error:
Floating point exception
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: rvismith1115 at gmail dot com
Target Milestone: ---
Created attachment 59762
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59762&action=edit
reduced testcase
Code:
```
#include <riscv_vector.h>
#define dataLen 100
uint32_t a[dataLen];
uint32_t b[dataLen];
int main(){
for (int i=0; i<dataLen; ++i){ a[i]=i; b[i]=i; }
int avl1 = 100 - 100 % 7;
uint32_t* ptr_a = a; uint32_t* ptr_b = b;
for (size_t vl; avl1 > 0; avl1 -= vl * 7){
vl = __riscv_vsetvl_e32m1(avl1 / 7);
vuint32m1_t va = __riscv_vle32_v_u32m1(ptr_a, vl);
vuint32m1x7_t vb = __riscv_vlseg7e32_v_u32m1x7(ptr_b, vl);
vb = __riscv_vset_v_u32m1_u32m1x7(vb, 0, va);
ptr_a += vl * 7; ptr_b += vl * 7;
}
return 0;
}
```
Crash Message: (when no flags are used)
```
$ /home/compiler/gcc/15-20241117/bin/gcc ice.c
ice.c: In function 'main':
ice.c:15:5: internal compiler error: Floating point exception
15 | vb = __riscv_vset_v_u32m1_u32m1x7(vb, 0, va);
| ^~
0x2e9e025 internal_error(char const*, ...)
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/diagnostic-global-context.cc:518
0x139bcc3 crash_signal
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/toplev.cc:323
0x7fc84aa1a31f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x18c5706 poly_int<2u, long>::is_constant() const
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/poly-int.h:560
0x18c5706 poly_int<2u, poly_result<long, long, poly_coeff_pair_traits<long,
long>::result_kind>::type> exact_div<2u, long, long>(poly_int<2u, long> const&,
poly_int<2u, long> const&)
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/poly-int.h:2172
0x18c5706 riscv_vector::vset_def::check(riscv_vector::function_checker&) const
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/config/riscv/riscv-vector-builtins-shapes.cc:911
0x18c17cc riscv_vector::function_checker::check()
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/config/riscv/riscv-vector-builtins.cc:4415
0x18c17cc riscv_vector::check_builtin_call(unsigned int, vec<unsigned int,
va_heap, vl_ptr>, unsigned int, tree_node*, unsigned int, tree_node**)
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/config/riscv/riscv-vector-builtins.cc:4792
0xcab74a build_function_call_vec(unsigned int, vec<unsigned int, va_heap,
vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc,
vl_embed>*, tree_node*)
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-typeck.cc:3844
0xcedb90 c_parser_postfix_expression_after_primary
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:13372
0xcd1afe c_parser_postfix_expression
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:12923
0xcd6a9a c_parser_unary_expression
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:10364
0xcd868b c_parser_cast_expression
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:10205
0xcd8992 c_parser_binary_expression
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:9973
0xcd9e56 c_parser_conditional_expression
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:9668
0xcda697 c_parser_expr_no_commas
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:9581
0xcda76a c_parser_expr_no_commas
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:9624
0xcdab33 c_parser_expression
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:13512
0xcdb0eb c_parser_expression_conv
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:13572
0xcff29f c_parser_statement_after_labels
/home/riscv-files/build-compilers/gcc-15-20241117/gcc/c/c-parser.cc:8080
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.
```
Version info:
```
$ /home/compiler/gcc/15-20241117/bin/gcc --version
gcc () 15.0.0 20241117 (experimental)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```