[tree-ssa] Stopgap bugfix for 20040303-1.c

Andrew Pinski pinskia@physics.uc.edu
Thu Mar 4 18:39:00 GMT 2004


On Mar 4, 2004, at 10:34, law@redhat.com wrote:
>
>
> 	* fold-const.c (fold): When rebuilding the expression after a
> 	call to fold_relational_hi_lo, make sure to convert the type of
> 	the second argument to the type of the first.
>
> Index: fold-const.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
> retrieving revision 1.213.2.78
> diff -c -p -r1.213.2.78 fold-const.c
> *** fold-const.c	4 Mar 2004 15:38:44 -0000	1.213.2.78
> --- fold-const.c	4 Mar 2004 18:28:08 -0000
> *************** fold (tree expr)
> *** 7487,7493 ****
>   	return t1;
>         else if (code != TREE_CODE (t)
>   	       || TREE_OPERAND (t, 0) != arg0 || TREE_OPERAND (t, 1) != 
> arg1)
> ! 	t = build (code, type, arg0, arg1);
>
>         /* If this is an EQ or NE comparison of a constant with a 
> PLUS_EXPR or
>   	 a MINUS_EXPR of a constant, we can convert it into a comparison 
> with
> --- 7487,7493 ----
>   	return t1;
>         else if (code != TREE_CODE (t)
>   	       || TREE_OPERAND (t, 0) != arg0 || TREE_OPERAND (t, 1) != 
> arg1)
> ! 	t = build (code, type, arg0, convert (TREE_TYPE (arg0), arg1));
>
>         /* If this is an EQ or NE comparison of a constant with a 
> PLUS_EXPR or
>   	 a MINUS_EXPR of a constant, we can convert it into a comparison 
> with

This is wrong, you should be using fold_convert of convert (as convert 
is front-end convert)
instead.

Thanks,
Andrew Pinski



More information about the Gcc-patches mailing list