aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-01-04 22:15:46 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-01-04 22:15:46 +0000
commit82701bd204992a7349168cddc8b35884da478be0 (patch)
treebec0e8e8ca2c9a66a62afb0fcd44c4da0f7d1c9a
parenteb83e2d7f0f746bf64276ebb3931b20ae0cd7398 (diff)
downloadgcc-82701bd204992a7349168cddc8b35884da478be0.zip
gcc-82701bd204992a7349168cddc8b35884da478be0.tar.gz
gcc-82701bd204992a7349168cddc8b35884da478be0.tar.bz2
Don't create erroneous COND_EXPR.
From-SVN: r168485
-rw-r--r--gcc/go/gofrontend/statements.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index d8ea9f0..c0efc2d 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -2985,14 +2985,19 @@ tree
If_statement::do_get_tree(Translate_context* context)
{
gcc_assert(this->cond_ == NULL || this->cond_->type()->is_boolean_type());
- tree ret = build3(COND_EXPR, void_type_node,
- (this->cond_ == NULL
- ? boolean_true_node
- : this->cond_->get_tree(context)),
- this->then_block_->get_tree(context),
- (this->else_block_ == NULL
- ? NULL_TREE
- : this->else_block_->get_tree(context)));
+ tree cond_tree = (this->cond_ == NULL
+ ? boolean_true_node
+ : this->cond_->get_tree(context));
+ tree then_tree = this->then_block_->get_tree(context);
+ tree else_tree = (this->else_block_ == NULL
+ ? NULL_TREE
+ : 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());
return ret;
}