This is the mail archive of the
mailing list for the GCC project.
[PATCH] Fix ICE in fold-const.c
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Sun, 16 May 2004 23:02:07 -0400
- Subject: [PATCH] Fix ICE in fold-const.c
I do not have a testcase for this patch as it cannot happen in C or
C++ or Java as you convert the (bool)(a) into a != 0.
The ICE can happens when !(bool)a is passed to fold because fold will
use STRIP_SIGNED_NOPS which removes the cast to bool which causes an
ICE in invert_truthvalue.
Bootstrapped on powerpc-apple-darwin7.3.0 with no regressions.
* fold-const.c (fold) [case TRUTH_NOT_EXPR]: Make sure the type is
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.376
diff -u -p -r1.376 fold-const.c
--- fold-const.c 15 May 2004 23:07:49 -0000 1.376
+++ fold-const.c 16 May 2004 22:42:16 -0000
@@ -7192,6 +7202,9 @@ fold (tree expr)
+ if (TREE_CODE (arg0) != BOOLEAN_TYPE)
+ arg0 = fold (TREE_OPERAND (t, 0));
/* 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,