On 09/30/2015 01:48 AM, Richard Biener wrote:
On Tue, Sep 29, 2015 at 6:55 PM, Jeff Law <l...@redhat.com> wrote:
The pdp11 port fails to build with the trunk because of a warning.
Essentially VRP determines that the result of using BRANCH_COST is a
constant with the range [0..1].  That's always less than 4, 3 and the
various other magic constants used with BRANCH_COST and VRP issues a warning
about that comparison.

It does?  Huh.  Is it about undefined overflow which is the only thing
VRP should end up
warning about?  If so I wonder how that happens, at least I can't
reproduce it for
--target=pdp11 --enable-werror build of cc1.
You have to use a trunk compiler to build the pdp11 cross. You'll bump into this repeatedly:

  if (warn_type_limits
      && ret && only_ranges
      && TREE_CODE_CLASS (code) == tcc_comparison
      && TREE_CODE (op0) == SSA_NAME)
    {
      /* If the comparison is being folded and the operand on the LHS
         is being compared against a constant value that is outside of
         the natural range of OP0's type, then the predicate will
         always fold regardless of the value of OP0.  If -Wtype-limits
         was specified, emit a warning.  */
      tree type = TREE_TYPE (op0);
      value_range_t *vr0 = get_value_range (op0);

      if (vr0->type == VR_RANGE
          && INTEGRAL_TYPE_P (type)
          && vrp_val_is_min (vr0->min)
          && vrp_val_is_max (vr0->max)
          && is_gimple_min_invariant (op1))
        {
          location_t location;

          if (!gimple_has_location (stmt))
            location = input_location;
          else
            location = gimple_location (stmt);

          warning_at (location, OPT_Wtype_limits,
                      integer_zerop (ret)
                      ? G_("comparison always false "
                           "due to limited range of data type")
                      : G_("comparison always true "
                           "due to limited range of data type"));
        }
    }

  return ret;
}


Jeff

Reply via email to