From: Kazu Hirata Date: Tue, 26 Apr 2005 15:16:51 +0000 (+0000) Subject: re PR tree-optimization/21047 (ASSERT_EXPR handling in fold never triggers.) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb4819f012ee4e3db252e38e3594018a883c4070;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74a7b894c48..2d441c43cab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ * basic-block.h (ei_cond): New. (FOR_EACH_EDGE): Call ei_cond. + PR tree-optimization/21047 + * fold-const.c (fold_binary): Abort on ASSERT_EXPR. + (fold): Don't handle ASSERT_EXPR. + 2005-04-25 Roger Sayle * sched-deps.c (sched_analyze_1): On STACK_REGS targets, x87, treat diff --git a/gcc/fold-const.c b/gcc/fold-const.c index a75d1a25063..416d89e1cdf 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 , return Y if COND can be folded - to boolean_true_node. If COND folds to boolean_false_node, - return ASSERT_EXPR . 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) */