diff mbox

Go patch committed: Don't crash on if with erroneous conditional

Message ID mcr62srgjqz.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Feb. 11, 2011, 6:36 a.m. UTC
This patch to the Go frontend avoids a crash when an if statement has an
erroneous conditional.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r c4d7da5b8d87 go/statements.cc
--- a/go/statements.cc	Thu Feb 10 22:34:01 2011 -0800
+++ b/go/statements.cc	Thu Feb 10 22:35:05 2011 -0800
@@ -2994,7 +2994,9 @@ 
 tree
 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()
+	     || this->cond_->type()->is_error_type());
   tree cond_tree = (this->cond_ == NULL
 		    ? boolean_true_node
 		    : this->cond_->get_tree(context));