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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ugh:
                  value_range_type rng = get_range_info (offset, &min, &max);
                  if (rng == VR_RANGE)
                    {
                      offrange[0] = min.to_shwi ();
                      offrange[1] = max.to_shwi ();
                    }
                  else if (rng == VR_ANTI_RANGE)
                    {
                      offrange[0] = (max + 1).to_shwi ();
                      offrange[1] = (min - 1).to_shwi ();
                    }
What guarantees that min or max fit into shwi?
Why the hops through shwi at all?  Just do:
  offrange[0] = offset_int (min, UNSIGNED);
etc. (or, if you want to be prepared for POINTER_PLUS_EXPR ever being a signed
type, offrange[0] = offset_int (min, TYPE_SIGN (TREE_TYPE (offset)));

if (code == NOP_EXPR)
should have been
if (CONVERT_EXPR_CODE_P (code))

                {
                  offset_int off = int_cst_value (offset);
                  offrange[0] = off;
                  offrange[1] = off;
should have used again offset_int off = offset_int::from (offset, TYPE_SIGN
(TREE_TYPE (offset)));

                          && gimple_assign_rhs_code (stmt) == NOP_EXPR)
again

Marek, your patch is definitely going in the right direction and is preapproved
for trunk.  But it isn't sufficient.

Reply via email to