https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98177
Bug ID: 98177 Summary: [11 Regression] SVE: ICE in expand_direct_optab_fn, at internal-fn.c:3368 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- For the following C++ testcase: int a, b; short c; void d(long e) { for (int f = 0; f < b; f += 1) for (short g = 0; g < c; g += 5) a = (short)e; } we ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=128 since r11-4912-g46c705e70e078f6a1920d92e49042125d5e18495. To reproduce: $ aarch64-elf-gcc -c -S -Ofast -march=armv8.2-a+sve -msve-vector-bits=128 test.cc during RTL pass: expand test.cc: In function 'void d(long int)': test.cc:3:6: internal compiler error: in expand_direct_optab_fn, at internal-fn.c:3368 3 | void d(long e) { | ^ 0xd63e0f expand_direct_optab_fn /home/alecop01/toolchain/src/gcc/gcc/internal-fn.c:3368 0xd64978 expand_REDUC_MAX /home/alecop01/toolchain/src/gcc/gcc/internal-fn.def:209 0xd6631e expand_internal_call(internal_fn, gcall*) /home/alecop01/toolchain/src/gcc/gcc/internal-fn.c:4089 0xd66338 expand_internal_call(gcall*) /home/alecop01/toolchain/src/gcc/gcc/internal-fn.c:4097 0xae74ad expand_call_stmt /home/alecop01/toolchain/src/gcc/gcc/cfgexpand.c:2740 0xae74ad expand_gimple_stmt_1 /home/alecop01/toolchain/src/gcc/gcc/cfgexpand.c:3835 0xae74ad expand_gimple_stmt /home/alecop01/toolchain/src/gcc/gcc/cfgexpand.c:3999 0xaf1827 expand_gimple_basic_block /home/alecop01/toolchain/src/gcc/gcc/cfgexpand.c:6043 0xaf2ede execute /home/alecop01/toolchain/src/gcc/gcc/cfgexpand.c:6727 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Curiously, I can only reproduce the ICE when the testcase is treated as C++. It seems we fail to vectorize the testcase if we instead treat it as C.