[PATCH, i386]: Fix out-of-bound array access in i386.c

Richard Henderson rth@redhat.com
Thu Aug 5 20:00:00 GMT 2010


On 08/05/2010 12:11 AM, Uros Bizjak wrote:
>       HOST_WIDE_INT ct = INTVAL (operands[2]);
>       HOST_WIDE_INT cf = INTVAL (operands[3]);
>       HOST_WIDE_INT diff;
> 
>       diff = ct - cf;
> 
> ...
> 
> 	  diff = -diff;
> 
> I don't know what is the proper way to fix these. Any hints?

Probably by simply making these (and a few other temporary) variables
unsigned, so that we have defined 2s compliment arithmetic.  It will
require at least one cast here:

>       if (diff < 0)

but there may be a few others.



r~



More information about the Gcc-patches mailing list