compiler: Don't make gc symbol for bad array type.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 12 Aug 2015 17:21:11 +0000 (17:21 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 12 Aug 2015 17:21:11 +0000 (17:21 +0000)
    When parsing a malformed array type, i.e. invalid length, gccgo
    would loop indefinitely based off of a uninitialized length variable.

    Fixes golang/go#11539.

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

From-SVN: r226825

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

index 5046fbbb559b8bfb71278fae6f23fc262c54a872..c9e63002c9937a7a44c474e852411d7f85def89a 100644 (file)
@@ -1,4 +1,4 @@
-55175f7ee0db2c1e68423216d7744be80071ed6c
+5fc38e74d132cd6f4e7b56e6bcf9fe57031ab203
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 7a7a1039be16e3ef48bdef19f56f1510c482e094..5418313aea25dce0601cad7c227343d6e47e96f5 100644 (file)
@@ -6423,7 +6423,10 @@ Array_type::array_gc_symbol(Gogo* gogo, Expression_list** vals,
   unsigned long bound;
   if (!this->length_->numeric_constant_value(&nc)
       || nc.to_unsigned_long(&bound) == Numeric_constant::NC_UL_NOTINT)
-    go_assert(saw_errors());
+    {
+      go_assert(saw_errors());
+      return;
+    }
 
   Btype* pbtype = gogo->backend()->pointer_type(gogo->backend()->void_type());
   int64_t pwidth = gogo->backend()->type_size(pbtype);