Commit 82701bd2 by Ian Lance Taylor

Don't create erroneous COND_EXPR.

From-SVN: r168485
parent eb83e2d7
...@@ -2985,14 +2985,19 @@ tree ...@@ -2985,14 +2985,19 @@ tree
If_statement::do_get_tree(Translate_context* context) If_statement::do_get_tree(Translate_context* context)
{ {
gcc_assert(this->cond_ == NULL || this->cond_->type()->is_boolean_type()); gcc_assert(this->cond_ == NULL || this->cond_->type()->is_boolean_type());
tree ret = build3(COND_EXPR, void_type_node, tree cond_tree = (this->cond_ == NULL
(this->cond_ == NULL ? boolean_true_node
? boolean_true_node : this->cond_->get_tree(context));
: this->cond_->get_tree(context)), tree then_tree = this->then_block_->get_tree(context);
this->then_block_->get_tree(context), tree else_tree = (this->else_block_ == NULL
(this->else_block_ == NULL ? NULL_TREE
? NULL_TREE : this->else_block_->get_tree(context));
: this->else_block_->get_tree(context))); if (cond_tree == error_mark_node
|| then_tree == error_mark_node
|| else_tree == error_mark_node)
return error_mark_node;
tree ret = build3(COND_EXPR, void_type_node, cond_tree, then_tree,
else_tree);
SET_EXPR_LOCATION(ret, this->location()); SET_EXPR_LOCATION(ret, this->location());
return ret; return ret;
} }
......
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