The ada failure reported in the PR was being caused by vect_check_gather_scatter
failing to deal with bit offsets that weren't multiples of BITS_PER_UNIT. This
patch makes vect_check_gather_scatter reject memory accesses with such offsets.
gcc/ChangeLog:
PR tree-optimization/107346
* tree-vect-data-refs.cc (vect_check_gather_scatter): Reject offsets
that aren't multiples of BITS_PER_UNIT.
if (reversep)
return false;
+ /* PR 107346. Packed structs can have fields at offsets that are not
+ multiples of BITS_PER_UNIT. Do not use gather/scatters in such cases. */
+ if (!multiple_p (pbitpos, BITS_PER_UNIT))
+ return false;
+
poly_int64 pbytepos = exact_div (pbitpos, BITS_PER_UNIT);
if (TREE_CODE (base) == MEM_REF)