aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-09-15 21:07:54 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-09-15 21:07:54 +0000
commit41dfa93fb8d0cfd3a64ba3e6eba9fbbe1d66090c (patch)
tree3241c6cfc5f9b0874103fbef0c9668883028a528 /gcc/go
parentefc79e1e860fd4fa7df5ba68c14cf59723205274 (diff)
downloadgcc-41dfa93fb8d0cfd3a64ba3e6eba9fbbe1d66090c.zip
gcc-41dfa93fb8d0cfd3a64ba3e6eba9fbbe1d66090c.tar.gz
gcc-41dfa93fb8d0cfd3a64ba3e6eba9fbbe1d66090c.tar.bz2
compiler: check error expression in Array_type::get_backend_length
Otherwise, a zero length is created in the backend and the backend doesn't know there is an error. Reviewed-on: https://go-review.googlesource.com/61610 From-SVN: r252849
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/types.cc5
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index a1ccb2b..a63d921 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-4e063a8eee636cce17aea48c7183e78431174de3
+de7b370901c4fc6852eaa7372282bb699429ec4a
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/types.cc b/gcc/go/gofrontend/types.cc
index e91922c..a00b80a 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -7638,6 +7638,11 @@ Array_type::get_backend_length(Gogo* gogo)
go_assert(this->length_ != NULL);
if (this->blength_ == NULL)
{
+ if (this->length_->is_error_expression())
+ {
+ this->blength_ = gogo->backend()->error_expression();
+ return this->blength_;
+ }
Numeric_constant nc;
mpz_t val;
if (this->length_->numeric_constant_value(&nc) && nc.to_int(&val))