OSDN Git Service

Don't crash when using receive on erroneous channel.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Feb 2011 13:58:51 +0000 (13:58 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Feb 2011 13:58:51 +0000 (13:58 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170468 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/expressions.cc

index 2e31e80..259faa1 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());