fix for execute/991221-1.c -O1 failure

Joern Rennecke amylaar@cygnus.co.uk
Fri Dec 31 23:54:00 GMT 1999


>   > Should I get the limits from somewhere else?  Or should pointers be
>   > treated as having indeed no bounds?
> Treating the pointer type as having no bounds is certainly a safe thing to
> do.  Finding the range of a pointer type is somewhat complicated by the
> signed vs unsigned issues.

Well, treating it as having no bounds also requires some special handling,
since otherwise we would keep the original bug for unsigned pointers.

> Note instead of:
> 
> !   sgn0 = (upper0_p
> ! 	  ? (! arg0 || operand_equal_p (arg0, TYPE_MAX_VALUE (type), 1)
> ! 	     ? 1 : 0)
> ! 	  : (! arg0 || operand_equal_p (arg0, TYPE_MIN_VALUE (type), 1)
> ! 	     ? -1 : 0));
> 
> 
> It might be better to write
> 
>    sgn0 = (! arg0 || operand_equal_p (arg0, TYPE_MAX_VALUE (type), 1)
>            ? (upper0_p ? 1 : -1) : 0);

Note that there are two different macro calls, one for the minimum
and one for the maximum.



More information about the Gcc mailing list