compiler: Don't crash on erroneous channel reads.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 16 Sep 2015 18:04:22 +0000 (18:04 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 16 Sep 2015 18:04:22 +0000 (18:04 +0000)
    Fixes golang/go#12320.

    Reviewed-on: https://go-review.googlesource.com/13932

From-SVN: r227834

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc

index fb61c64ea310ebdac4e7de6a876579846df3b2b4..c150747ae36b0f3549f0c6e22b0b2011bc945497 100644 (file)
@@ -1,4 +1,4 @@
-79f457a267ff2bf8e65db4bcec0cbc7add79227a
+1cb26dc898bda1e85f4dd2ee204adbce792e4813
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 49d4d27071a601d565c70fe7479544769e2c56d6..542f3de6fbbd76b9b39ea1a3460d3ea5eb3d3bc9 100644 (file)
@@ -3472,6 +3472,15 @@ Unsafe_type_conversion_expression::do_get_backend(Translate_context* context)
 
   Type* t = this->type_;
   Type* et = this->expr_->type();
+
+  if (t->is_error_type()
+      || this->expr_->is_error_expression()
+      || et->is_error_type())
+    {
+      go_assert(saw_errors());
+      return context->backend()->error_expression();
+    }
+
   if (t->array_type() != NULL)
     go_assert(et->array_type() != NULL
               && t->is_slice_type() == et->is_slice_type());