aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2005-04-26 15:16:51 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-04-26 15:16:51 +0000
commitcb4819f012ee4e3db252e38e3594018a883c4070 (patch)
tree2c8cbc8c0ddc406557bcc3346b925422a34dc063 /gcc/fold-const.c
parentf3522a84f3aedacbfa06a31d334f1b4d6738fcfc (diff)
downloadgcc-cb4819f012ee4e3db252e38e3594018a883c4070.zip
gcc-cb4819f012ee4e3db252e38e3594018a883c4070.tar.gz
gcc-cb4819f012ee4e3db252e38e3594018a883c4070.tar.bz2
re PR tree-optimization/21047 (ASSERT_EXPR handling in fold never triggers.)
PR tree-optimization/21047 * fold-const.c (fold_binary): Abort on ASSERT_EXPR. (fold): Don't handle ASSERT_EXPR. From-SVN: r98770
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index a75d1a2..416d89e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9864,6 +9864,10 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
return build_complex (type, arg0, arg1);
return NULL_TREE;
+ case ASSERT_EXPR:
+ /* An ASSERT_EXPR should never be passed to fold_binary. */
+ gcc_unreachable ();
+
default:
return NULL_TREE;
} /* switch (code) */
@@ -10147,21 +10151,6 @@ fold (tree expr)
case CONST_DECL:
return fold (DECL_INITIAL (t));
- case ASSERT_EXPR:
- {
- /* Given ASSERT_EXPR <Y, COND>, return Y if COND can be folded
- to boolean_true_node. If COND folds to boolean_false_node,
- return ASSERT_EXPR <Y, 0>. Otherwise, return the original
- expression. */
- tree c = fold (ASSERT_EXPR_COND (t));
- if (c == boolean_true_node)
- return ASSERT_EXPR_VAR (t);
- else if (c == boolean_false_node)
- return build (ASSERT_EXPR, TREE_TYPE (t), ASSERT_EXPR_VAR (t), c);
- else
- return t;
- }
-
default:
return t;
} /* switch (code) */