https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128394
Bug ID: 128394
Summary: ICE in gsi_insert_seq_nodes_after, at
gimple-iterator.cc:274 from vect_do_peeling at -O2
-mavx2
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: lyfanyang at smail dot nju.edu.cn
Target Milestone: ---
Created attachment 66073
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66073&action=edit
Sample in description
The following C code makes the vectorizer ICE at -O2 -mavx2. It compiles
without errors at -O1 -march=haswell, at plain -O2 or -O3, at -O2 -mavx, and
at -O2 -march=haswell -fno-tree-vectorize.
$ cat ice.c
char a;
void
b (void)
{
&&c;
void *e = &&d;
goto *e;
f:
a = a + 1;
goto g;
h:
goto f;
g:
if (4U + a)
d:
c:
goto h;
}
$ gcc -O2 -mavx2 -c ice.c
during GIMPLE pass: vect
ice.c: In function 'b':
ice.c:4:1: internal compiler error: in gsi_insert_seq_nodes_after, at
gimple-iterator.cc:274
4 | b (void)
| ^
0x2a8a526 internal_error(char const*, ...)
gcc/diagnostic-global-context.cc:787
0xbeee8e fancy_abort(char const*, int, char const*)
gcc/diagnostics/context.cc:1813
0x881bff gsi_insert_seq_nodes_after
gcc/gimple-iterator.cc:274
0x17628b9 vect_do_peeling(_loop_vec_info*, tree_node*, tree_node*, tree_node**,
tree_node**, tree_node**, int, bool, bool, tree_node**)
gcc/tree-vect-loop-manip.cc:3865
0x173a827 vect_transform_loop(_loop_vec_info*, gimple*)
gcc/tree-vect-loop.cc:11504
0x17a3b4c vect_transform_loops
gcc/tree-vectorizer.cc:1039
0x17a4283 try_vectorize_loop_1
gcc/tree-vectorizer.cc:1188
0x17a4283 try_vectorize_loop
gcc/tree-vectorizer.cc:1218
0x17a48bc execute
gcc/tree-vectorizer.cc:1335
The backtrace above was printed with -O2 -march=haswell; -O2 -mavx2,
-O3 -march=haswell, -march=x86-64-v3 and -march=skylake-avx512 also ICE.
Versions tested:
9.4.0 no ICE
16.2.0 ICE (same assert, gimple-iterator.cc:266)
17.0.0 20261018 ICE
17.0.0 20261101 ICE
Target: x86_64-pc-linux-gnu
Configured with: configure --enable-languages=c,c++ --disable-bootstrap
--disable-multilib --disable-nls --enable-checking=yes
The testcase was reduced with C-Reduce from a Csmith program obfuscated with
Tigress (EncodeArithmetic and Flatten).