compiler: check error expression in Array_type::get_backend_length
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 15 Sep 2017 21:07:54 +0000 (21:07 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 15 Sep 2017 21:07:54 +0000 (21:07 +0000)
    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

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/types.cc

index a1ccb2bc75ec9fb0dafcbdb93c1facdeef46b031..a63d921ab577d2a24f21f0db62874eed0b8dd5cc 100644 (file)
@@ -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.
index e91922c1cac8d21a8c1d2bdc4631f0fe9c814d54..a00b80a7e6c414e5767133ea94135c2048fed1e1 100644 (file)
@@ -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))