https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82491

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
      if (!integer_zerop (TREE_OPERAND (base, 1)))
        {
          if (!tree_fits_shwi_p (TREE_OPERAND (base, 1)))
            return NULL_TREE;

the above check isn't enough to catch overflow below.

          *bit_offset += (mem_ref_offset (base).to_short_addr ()
                          * BITS_PER_UNIT);

I suppose doing

  offset_int boff = *bit_offset + mem_ref_offset (base) * BITS_PER_UNIT;
  if (boff.fits_shwi_p ())
    *bit_offset = boff.to_short_addr ();
  else
    return NULL_TREE;

would work.

Reply via email to