diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-09-16 18:04:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-09-16 18:04:22 +0000 |
commit | ca2fe289df060b0564c52738e17f71e1d23366c0 (patch) | |
tree | 2e11fbdb63555f55729904e624ae17ce0605c5b9 | |
parent | ea09f50d91fc79d3d494c352b71556c605e89159 (diff) | |
download | gcc-ca2fe289df060b0564c52738e17f71e1d23366c0.zip gcc-ca2fe289df060b0564c52738e17f71e1d23366c0.tar.gz gcc-ca2fe289df060b0564c52738e17f71e1d23366c0.tar.bz2 |
compiler: Don't crash on erroneous channel reads.
Fixes golang/go#12320.
Reviewed-on: https://go-review.googlesource.com/13932
From-SVN: r227834
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index fb61c64..c150747 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 49d4d27..542f3de 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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()); |