https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97615
Bug ID: 97615 Summary: [11 Regression] -O3 on -Wsequence-point-unclean code ICEs: during GIMPLE pass: slp: internal compiler error: in vectorizable_live_operation, at tree-vect-loop.c:8497 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Host: x86_64-pc-linux-gnu The ICE initially observed on dolphin-emu code base. cvise reduced it down to the following example: $ cat bug.cpp // g++-11.0.0 -O3 -std=c++17 -c bug.cpp -o bug.o -Wall short *a; void b(int c, int d) { *a++ = *a++ = c; *a++ = d; } int e, f; void g() { b(e + f - 2, e + f - 1); b(e + f - 1, 0); } gcc crashes as: $ LANG=C g++-11.0.0 -O3 -c bug.cpp -o bug.o -Wall bug.cpp: In function 'void b(int, int)': bug.cpp:4:5: warning: operation on 'a' may be undefined [-Wsequence-point] 4 | *a++ = *a++ = c; | ~^~ during GIMPLE pass: slp bug.cpp: In function 'void g()': bug.cpp:8:6: internal compiler error: in vectorizable_live_operation, at tree-vect-loop.c:8497 8 | void g() { | ^ 0x60f1cb vectorizable_live_operation(vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*, int, bool, vec<stmt_info_for_cost, va_heap, vl_ptr>*) /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-loop.c:8497 0xe82bd7 can_vectorize_live_stmts /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-stmts.c:10529 0xea4f58 vect_transform_stmt(vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*) /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-stmts.c:10913 0xed1611 vect_schedule_slp_node /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-slp.c:5360 0xedd1cf vect_schedule_scc /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-slp.c:5495 0xedd8fc vect_schedule_slp(vec_info*, vec<_slp_instance*, va_heap, vl_ptr>) /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-slp.c:5624 0xeded4b vect_slp_region /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-slp.c:4232 0xeded4b vect_slp_bbs /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-slp.c:4350 0xedfb3c vect_slp_function(function*) /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vect-slp.c:4418 0xee1923 execute /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-vectorizer.c:1437