https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105254
Bug ID: 105254 Summary: ICE in exact_div, at poly-int.h:2219 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com CC: rsandifo at gcc dot gnu.org Target Milestone: --- Target: aarch64-linux-gnu g++ 12.0.1 20220410 snapshot (g:54c5e064cc3dc3c9b3dff12b6d48dc3efd482b07) ICEs when compiling the following testcase w/ -mcpu=demeter -O1 -ftree-loop-vectorize: template <typename> struct complex; template <> struct complex<double> { void operator+= (complex r) { v_ += r.v_; } _Complex v_; }; template <typename T> void bar (T); void foo (complex<double> *x) { complex<double> s {0.0}; for (int i = 0; i < 16; ++i) s += x[i]; bar<complex<double>> (s); } % aarch64-linux-gnu-g++-12.0.1 -mcpu=demeter -O1 -ftree-loop-vectorize -c blv9apl0.cpp during GIMPLE pass: vect blv9apl0.cpp: In function 'void foo(complex<double>*)': blv9apl0.cpp:15:1: internal compiler error: in exact_div, at poly-int.h:2219 15 | foo (complex<double> *x) | ^~~ 0x8a54a7 poly_int<2u, poly_result<unsigned long, if_nonpoly<unsigned int, unsigned int, poly_int_traits<unsigned int>::is_poly>::type, poly_coeff_pair_traits<unsigned long, if_nonpoly<unsigned int, unsigned int, poly_int_traits<unsigned int>::is_poly>::type>::result_kind>::type> exact_div<2u, unsigned long, unsigned int>(poly_int_pod<2u, unsigned long> const&, unsigned int) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/poly-int.h:2219 0x8a8422 poly_int<2u, poly_result<unsigned long, if_nonpoly<unsigned int, unsigned int, poly_int_traits<unsigned int>::is_poly>::type, poly_coeff_pair_traits<unsigned long, if_nonpoly<unsigned int, unsigned int, poly_int_traits<unsigned int>::is_poly>::type>::result_kind>::type> exact_div<2u, unsigned long, unsigned int>(poly_int_pod<2u, unsigned long> const&, unsigned int) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vect-loop.cc:3158 0x8a8422 vect_analyze_loop(loop*, vec_info_shared*) /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vect-loop.cc:3032 0x14bc3d9 try_vectorize_loop_1 /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vectorizer.cc:1050 0x14bc3d9 try_vectorize_loop /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vectorizer.cc:1165 0x14bd074 execute /var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vectorizer.cc:1281