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

--- Comment #5 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to WANG Xuerui from comment #3)

>   /* Check if we have the same 4-element sets.  */
>   for (j = 0; j < nsets; j++, set = 4 * j)
>     for (i = 0; i < 4; i++)
>       if ((INTVAL (XVECEXP (op, 0, i))
>           != (INTVAL (XVECEXP (op, 0, set + i)) - set))
>          || !IN_RANGE (INTVAL (XVECEXP (op, 0, set + i)), 0, set + 3))
>         return false;
> 
> The code was copied from mips/mips.cc and the IN_RANGE check is buggy:
> should check if the value falls between *set* and (set + 3).

It happens to do the correct thing: if the value is smaller than set, "INTVAL
(XVECEXP (op, 0, set + i)) - set" would be negative and then it cannot be equal
to INTVAL (XVECEXP (op, 0, i)).  Thus the value smaller than set should have
been rejected already.

Reply via email to