https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117161
Bug ID: 117161 Summary: internal compiler error: in vect_get_vector_types_for_stmt, at tree-vect-stmts.c:12252 on gcc 10.2 for aarch64+sve Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Robert.Hardwick at arm dot com Target Milestone: --- We are seeing an internal compiler error when O3 optimization is used on aarch64+sve ( specifically neoverse-v1 ) compiler flags where the error is seen -O3 -march=armv8-a+sve -Wall -std=c++17 workaround Adding the compiler flag -fno-tree-vectorize fixes the problem Error: """ during GIMPLE pass: slp test.cpp: In function ‘int main()’: test.cpp:3:5: internal compiler error: in vect_get_vector_types_for_stmt, at tree-vect-stmts.c:12252 3 | int main() | ^~~~ Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. Preprocessed source stored into /tmp/cc1Tnw7l.out file, please attach this to your bugreport. """ Reproducer: """ #include <iostream> int main() { int64_t values[8]; for (int i = 0; i < 8; i++) { values[i] = 1.0f + i; } for (int i = 0; i < 8; i++) { if (values[i] <= 15) { std::cout << values[i] << std::endl; } } } """ The std::cout is there simply to prevent the compiler from optimizing values away since it is unused. This appears to be a GCC/G++ 10 issue as we don't see this in GCC 10 and above.