poly_span_traits fixes (PR 84811)
This patch fixes incorrect results for HOST_WIDE_INT positions
at opposite extremes when used with HOST_WIDE_INT sizes. It also
fixes UB when comparing such positions with unsigned HOST_WIDE_INT
sizes (although the results in that case were wrapv-correct).
2018-03-20 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/84811
* poly-int.h (poly_span_traits): Remove the T3 parameter and
promote HOST_WIDE_INT T2 - T1 results to unsigned HOST_WIDE_INT.
(maybe_in_range_p, known_in_range_p, ranges_known_overlap_p):
(known_subrange_p): Update accordingly. Cast each value involved
in the size comparison, rather than casting the result of the
subtraction.
gcc/testsuite/
PR tree-optimization/84811
* gcc.dg/torture/pr84811.c: New test.
From-SVN: r258743