[committed] canonicalize LE comparisons
Ian Lance Taylor
ian@airs.com
Wed Jul 13 20:29:00 GMT 2005
Eric Christopher <echristo@redhat.com> writes:
> + HOST_WIDE_INT original, plus_one;
> +
> + if (GET_CODE (*cmp1) != CONST_INT)
> + return false;
> +
> + original = INTVAL (*cmp1);
> + plus_one = trunc_int_for_mode (original + 1, mode);
> +
> + switch (*code)
> + {
> + case LE:
> + if (original < plus_one)
Since we've been just talking about it at length, aren't you relying
on signed integer overflow here? If HOST_WIDE_INT is 4 bytes, and
original == 0x7fffffff, you seem to be assuming that original + 1 ==
0x80000000 < 0. That is signed integer overflow, which is undefined
according to the C standard.
Or am I missing something?
Ian
More information about the Gcc-patches
mailing list