Commit cb4819f0 by Kazu Hirata Committed by Kazu Hirata

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
parent f3522a84
......@@ -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 <roger@eyesopen.com>
* sched-deps.c (sched_analyze_1): On STACK_REGS targets, x87, treat
......
......@@ -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) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment