https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121116
Bug ID: 121116
Summary: [ICE] internal compiler error: in
build_vector_from_val, at tree.cc:2244
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: njuwy at smail dot nju.edu.cn
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/jPrvn8hPW
The crash triggering program (compile with `gcc-16 -O2`):
```
#include <stdlib.h>
#include <stdckdint.h>
#include <string.h>
typedef _BitInt(16) bit16;
[[nodiscard]] static bit16 process_data(bit16 input) {
_Static_assert(sizeof(bit16) == 2, "Unexpected size of bit16");
return (input << 5) | (input >> 9);
}
int main(void) {
const bit16 data = 0b101'0101'0000'0000;
bit16 result = 0;
for (bit16 i = 0; i < 0b1000; ++i) {
result ^= process_data(data ^ i);
}
if (ckd_add(&result, result, 0x1234)) {
return EXIT_FAILURE;
}
return (result & 0xFF00) ? 0 : 1;
}
```
The crash output:
```
during GIMPLE pass: vect
<source>: In function 'main':
<source>:9:5: internal compiler error: in build_vector_from_val, at
tree.cc:2244
9 | int main(void) {
| ^~~~
0x253f0d5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x2560db6 internal_error(char const*, ...)
???:0
0xa02454 fancy_abort(char const*, int, char const*)
???:0
0x1491572 vectorizable_induction(_loop_vec_info*, _stmt_vec_info*, gimple**,
_slp_tree*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
???:0
0x1483f50 vect_transform_stmt(vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
???:0
0x14e61b7 vect_schedule_slp(vec_info*, vec<_slp_instance*, va_heap, vl_ptr>
const&)
???:0
0x14ab4ea vect_transform_loop(_loop_vec_info*, gimple*)
???:0
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
```