https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116647
Bug ID: 116647
Summary: Internal compiler error in operator[], at vec.h:910
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: yunboni at smail dot nju.edu.cn
Target Milestone: ---
Created attachment 59079
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59079&action=edit
The preprocessed file when using -O3
When I run the following code with -O3 flag, it went crash:
```c
int a;
char b;
long c, d, e;
unsigned long f;
long g() {
if (a <= 0)
return 1;
for (; d; d++) {
e = 0;
for (; e < a; e++) {
unsigned long h = 0;
switch (b)
case 2:
if (e)
h = 5;
c += h;
}
}
c /= f;
}
```
The full backtrace is:
0x24c4b25 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
???:0
0x24d80c5 internal_error(char const*, ...)
???:0
0x99f670 fancy_abort(char const*, int, char const*)
???:0
0x13bd81c vectorizable_reduction(_loop_vec_info*, _stmt_vec_info*, _slp_tree*,
_slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
???:0
0x139c223 vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*,
_slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
???:0
0x13fc15d vect_slp_analyze_operations(vec_info*)
???:0
0x13ca29b vect_analyze_loop(loop*, vec_info_shared*)
???:0
The gcc version I used is:
Using built-in specs.
COLLECT_GCC=/home/yunbo/eval/compilers/gcc_latest/bin/gcc
COLLECT_LTO_WRAPPER=/home/yunbo/eval/compilers/gcc_latest/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++ --prefix=/home/yunbo/eval/compilers/gcc_latest
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240909 (experimental) (GCC)
The details can be found here: https://godbolt.org/z/W8azvcW6d