From bf6526a05328b2809a044418b14d69ffb835ef21 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 24 Feb 2011 13:58:51 +0000 Subject: [PATCH] Don't crash when using receive on erroneous channel. From-SVN: r170468 --- gcc/go/gofrontend/expressions.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 2e31e806478..259faa128ec 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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()); -- 2.30.2