Don't crash when using receive on erroneous channel.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 24 Feb 2011 13:58:51 +0000 (13:58 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 24 Feb 2011 13:58:51 +0000 (13:58 +0000)
From-SVN: r170468

gcc/go/gofrontend/expressions.cc

index 2e31e8064785f30fd1e7605bf46a6c95ff55af78..259faa128ecae70fb9b75123b540de1fd4076c3e 100644 (file)
@@ -12264,7 +12264,11 @@ tree
 Receive_expression::do_get_tree(Translate_context* context)
 {
   Channel_type* channel_type = this->channel_->type()->channel_type();
-  gcc_assert(channel_type != NULL);
+  if (channel_type == NULL)
+    {
+      gcc_assert(this->channel_->type()->is_error_type());
+      return error_mark_node;
+    }
   Type* element_type = channel_type->element_type();
   tree element_type_tree = element_type->get_tree(context->gogo());