[patch] Fix pr23046

James A. Morrison ja2morri@csclub.uwaterloo.ca
Tue Aug 9 18:08:00 GMT 2005


Richard Henderson <rth@redhat.com> writes:

> On Sat, Aug 06, 2005 at 01:51:23AM -0400, James A. Morrison wrote:
>> 	PR middle-end/23046
>> 	* fold-const.c (fold_binary): Return 0 for X > TYPE_MAX_VALUE or
>> 	X < TYPE_MIN_VALUE.
>
> We've just discussed that it'll break Ada.
>
> Have you tried the patch I suggested to fix this bug?
>
>
> r~

 Sorry, I'd missed this.  I'll test it tonight.

>
>
> Index: fold-const.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
> retrieving revision 1.615
> diff -u -p -d -r1.615 fold-const.c
> --- fold-const.c	4 Aug 2005 18:55:14 -0000	1.615
> +++ fold-const.c	9 Aug 2005 18:02:40 -0000
> @@ -9172,7 +9172,7 @@ fold_binary (enum tree_code code, tree t
>        /* Comparisons with the highest or lowest possible integer of
>  	 the specified size will have known values.  */
>        {
> -	int width = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg1)));
> +	int width = TYPE_PRECISION (TREE_TYPE (arg1));
>  
>  	if (TREE_CODE (arg1) == INTEGER_CST
>  	    && ! TREE_CONSTANT_OVERFLOW (arg1)
>


-- 
Thanks,
Jim

http://www.csclub.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim



More information about the Gcc-patches mailing list