aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorKai Tietz <ktietz@redhat.com>2011-07-21 14:11:28 +0200
committerKai Tietz <ktietz@gcc.gnu.org>2011-07-21 14:11:28 +0200
commit7f3ff782991c13d787b67918e965c8a1dd620935 (patch)
tree3fcf31bae07e5780a558bd87b46dde066bfb218e /gcc/fold-const.c
parent0c53708eadd727f4089028e09840865db25a3cd9 (diff)
downloadgcc-7f3ff782991c13d787b67918e965c8a1dd620935.zip
gcc-7f3ff782991c13d787b67918e965c8a1dd620935.tar.gz
gcc-7f3ff782991c13d787b67918e965c8a1dd620935.tar.bz2
ChangeLog gcc/
2011-07-21 Kai Tietz <ktietz@redhat.com> * fold-const.c (fold_unary_loc): Preserve indirect comparison cast to none-boolean type. * tree-ssa.c (useless_type_conversion_p): Preserve cast from/to boolean-type. * gimplify.c (gimple_boolify): Handle boolification of comparisons. (gimplify_expr): Boolifiy non aggregate-typed comparisons. * tree-cfg.c (verify_gimple_comparison): Check result type of comparison expression. * tree-ssa-forwprop.c (forward_propagate_comparison): Adjust test of condition result and disallow type-cast sinking into comparison. ChangeLog gcc/testsuite 2011-07-21 Kai Tietz <ktietz@redhat.com> * gcc.dg/tree-ssa/pr30978.c: adjusted. * gcc.dg/tree-ssa/ssa-fre-6.c: Likewise. * gcc.dg/binop-xor1.c: Set to fail. * gcc.dg/binop-xor3.c: Set to fail. From-SVN: r176563
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c5539bf..889a92c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7664,11 +7664,11 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
non-integral type.
Do not fold the result as that would not simplify further, also
folding again results in recursions. */
- if (INTEGRAL_TYPE_P (type))
+ if (TREE_CODE (type) == BOOLEAN_TYPE)
return build2_loc (loc, TREE_CODE (op0), type,
TREE_OPERAND (op0, 0),
TREE_OPERAND (op0, 1));
- else
+ else if (!INTEGRAL_TYPE_P (type))
return build3_loc (loc, COND_EXPR, type, op0,
fold_convert (type, boolean_true_node),
fold_convert (type, boolean_false_node));