https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107346
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu.org --- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > I am wondering whether I should try to support this, or bail out of > vect_check_gather_scatter if pbitpos is not a multiple of BITS_PER_UNIT. The > latter obviously feels safer. It turns out that this vect_check_gather_scatter problem was latent since I can reproduce it with the GCC 12 compiler in Ada, and the following fix: diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index e32b1779c5d..a22eb2d763d 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -4013,7 +4013,7 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo, that can be gimplified before the loop. */ base = get_inner_reference (base, &pbitsize, &pbitpos, &off, &pmode, &punsignedp, &reversep, &pvolatilep); - if (reversep) + if (!multiple_p (pbitpos, BITS_PER_UNIT) || reversep) return false; poly_int64 pbytepos = exact_div (pbitpos, BITS_PER_UNIT); is sufficient to get rid of it.