https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97929
Bug ID: 97929 Summary: ICE: in exact_div, at poly-int.h:2219 (vect_get_num_vectors) Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- For the following testcase: extern int a[]; void b(short c) { for (long d; d; d += 1) a[d] = -(1 - c); } we ICE on AArch64 with: $ aarch64-elf-gcc -c -O1 -ftree-vectorize test.c during GIMPLE pass: vect test.c: In function 'b': test.c:2:6: internal compiler error: in exact_div, at poly-int.h:2219 2 | void b(short c) { | ^ 0x109cf78 poly_int<2u, poly_result<unsigned long, if_nonpoly<unsigned long, unsigned long, poly_int_traits<unsigned long>::is_poly>::type, poly_coeff_pair_traits<unsigned long, if_nonpoly<unsigned long, unsigned long, poly_int_traits<unsigned long>::is_poly>::type>::result_kind>::type> exact_div<2u, unsigned long, unsigned long>(poly_int_pod<2u, unsigned long> const&, unsigned long) /home/alecop01/toolchain/src/gcc/gcc/poly-int.h:2219 0x109cf78 poly_int<2u, poly_result<unsigned long, unsigned long, poly_coeff_pair_traits<unsigned long, unsigned long>::result_kind>::type> exact_div<2u, unsigned long, unsigned long>(poly_int_pod<2u, unsigned long> const&, poly_int_pod<2u, unsigned long> const&) /home/alecop01/toolchain/src/gcc/gcc/poly-int.h:2232 0x109cf78 vect_get_num_vectors /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.h:1617 0x109cf78 vect_get_num_copies /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.h:1628 0x109cf78 vectorizable_conversion /home/alecop01/toolchain/src/gcc/gcc/tree-vect-stmts.c:4686 0x10b8f31 vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*, _slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*) /home/alecop01/toolchain/src/gcc/gcc/tree-vect-stmts.c:10694 0x10d9660 vect_analyze_loop_operations /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:1758 0x10db3be vect_analyze_loop_2 /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:2478 0x10db3be vect_analyze_loop(loop*, vec_info_shared*) /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:2925 0x110a3df try_vectorize_loop_1 /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:995 0x110a917 try_vectorize_loop /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:1148 0x110acf1 vectorize_loops() /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:1229 0xf95b63 execute /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-loop.c:414 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. I can reproduce this since r11-5165-gd84ba819fe. However, prior to this commit, the build was broken since r11-5158-gec383f0bd, so the ICE could have been introduced by any of these commits: d84ba819fe2 Fix bootstrap 717e22dcd48 Fix gcc.dg/pr97897.c b08e0ee3018 refactor reassocs get_rank d8cf8976749 Fix operand_equal_p hash and copare of ODR_TYPE_REF 27842e2a1eb [3/3] [AArch64][vect] vec_widen_lshift pattern 9fc9573f9a5 [2/3] [vect] Add widening add, subtract patterns ec46904edfe [1/3][aarch64] Add vec_widen patterns to aarch64 ec383f0bdb4 tree-optimization/97901 - ICE propagating out LC PHIs