[PATCH] Fix ICE in fold-const.c

Andrew Pinski pinskia@physics.uc.edu
Sun May 30 18:55:00 GMT 2004


On May 30, 2004, at 12:10, Joseph S. Myers wrote:

> On Sun, 16 May 2004, Andrew Pinski wrote:
>
>> ChangeLog:
>>
>> 	* fold-const.c (fold) [case TRUTH_NOT_EXPR]: Make sure the type is
>> 	of BOOLEAN_TYPE.
>
> What is the current status of this patch?

I had forgot to apply the approved patch, woops.
Here is what I applied.

ChangeLog:
	* fold-const.c (fold) [case TRUTH_NOT_EXPR]: Make sure the type is
	of BOOLEAN_TYPE.


Patch:
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.383
diff -u -p -r1.383 fold-const.c
--- fold-const.c	28 May 2004 16:37:00 -0000	1.383
+++ fold-const.c	30 May 2004 16:16:50 -0000
@@ -7215,6 +7215,10 @@ fold (tree expr)
        goto associate;

      case TRUTH_NOT_EXPR:
+      /* The argument to invert_truthvalue must have Boolean type.  */
+      if (TREE_CODE (TREE_TYPE (arg0)) != BOOLEAN_TYPE)
+          arg0 = fold_convert (boolean_type_node, arg0);
+
        /* Note that the operand of this must be an int
  	 and its values must be 0 or 1.
  	 ("true" is a fixed value perhaps depending on the language,



More information about the Gcc-patches mailing list