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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
We have

      if (INTEGRAL_TYPE_P (type)
          && TYPE_OVERFLOW_UNDEFINED (type)
          && !expr_not_equal_to (to_add,
                                 wi::to_wide (TYPE_MIN_VALUE (type))))
        {
          tree utype = unsigned_type_for (type);
          to_add = chrec_convert_rhs (utype, to_add);
          to_add = chrec_fold_multiply (utype, to_add,
                                        build_int_cst_type (utype, -1));
          to_add = chrec_convert_rhs (type, to_add);

but all this dancing of course does not help for constants since the
conversion back to signed results in the same INT_MIN.

When I fix that we get (int) {(unsigned int) ay_32, +, 2147483648}_2
for the evolution and get_scev_info does

  if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
    {
      r.set_varying (type);
      return false; 

fixing the issue.  I'll note that fixing this in SCEV will likely pessimize
MINUS_EXPR handling a lot since we usually will not know that we do not
subtract INT_MIN ...

Reply via email to