aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2004-05-30 16:18:59 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-05-30 09:18:59 -0700
commitd22b7e1406dbb03a6d50d649030b70b6f42d1021 (patch)
treee9e26d68b3d3e84c0084b2450c7a914de5103eeb /gcc/fold-const.c
parenta4ddde0deeb34ed1aa26813e3e25c9a19df22d96 (diff)
downloadgcc-d22b7e1406dbb03a6d50d649030b70b6f42d1021.zip
gcc-d22b7e1406dbb03a6d50d649030b70b6f42d1021.tar.gz
gcc-d22b7e1406dbb03a6d50d649030b70b6f42d1021.tar.bz2
fold-const.c (fold): Make sure the type is of BOOLEAN_TYPE.
2004-05-30 Andrew Pinski <pinskia@physics.uc.edu> * fold-const.c (fold) [case TRUTH_NOT_EXPR]: Make sure the type is of BOOLEAN_TYPE. From-SVN: r82456
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 743f4ae..7445408 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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,