https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103744
--- Comment #4 from Arseny Solokha <asolokha at gmx dot com> --- The apparently related case: short int *s; int foo (int r, int z) { int *a; while (z < 1) { int i; i = *s; s += 2; r += a[i]; r += a[i]; z += 1; } return r; } % aarch64-linux-gnu-gcc-12.0.0 -mcpu=a64fx -O2 -fno-tree-scev-cprop -c egbadqtv.c during GIMPLE pass: vect egbadqtv.c: In function 'foo': egbadqtv.c:4:1: internal compiler error: in exact_div, at poly-int.h:2239 4 | foo (int r, int z) | ^~~ 0x7dd13e 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&) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/poly-int.h:2239 0x7defbe 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&) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/poly-int.h:2242 0x7defbe vect_record_loop_mask(_loop_vec_info*, auto_vec<rgroup_controls, 0ul>*, unsigned int, tree_node*, tree_node*) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:9060 0x1c978ba vectorizable_load /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-stmts.c:8875 0x1c9fe6a vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*, _slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-stmts.c:11086 0x120b698 vect_slp_analyze_node_operations_1 /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-slp.c:4481 0x120b698 vect_slp_analyze_node_operations /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-slp.c:4640 0x120b578 vect_slp_analyze_node_operations /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-slp.c:4620 0x120df26 vect_slp_analyze_operations(vec_info*) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-slp.c:4879 0x11e609e vect_analyze_loop_2 /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:2412 0x11e7f32 vect_analyze_loop_1 /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:2830 0x11e84d1 vect_analyze_loop(loop*, vec_info_shared*) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:2952 0x121e227 try_vectorize_loop_1 /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.c:1047 0x121e227 try_vectorize_loop /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.c:1162 0x121ef74 execute /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.c:1278