diff mbox series

Go patch committed: check for error expression in Array_type::get_backend_length

Message ID CAOyqgcWp9aYnesuemCmnwk4f0X9=JdWnOzqxi+9zjvV9ZSNycQ@mail.gmail.com
State New
Headers show
Series Go patch committed: check for error expression in Array_type::get_backend_length | expand

Commit Message

Ian Lance Taylor Sept. 15, 2017, 9:07 p.m. UTC
This patch by Cherry Zhang to the Go frontend checks for an  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.  Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
Committed to mainline.

Ian
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 252767)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 252746)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -7638,6 +7638,11 @@  Array_type::get_backend_length(Gogo* gog
   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))