From bb2978b8fd41165054ffe3cfcfa5311fffaf13cd Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 12 Aug 2015 17:21:11 +0000 Subject: [PATCH] compiler: Don't make gc symbol for bad array type. 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 | 2 +- gcc/go/gofrontend/types.cc | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 5046fbbb559..c9e63002c99 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 7a7a1039be1..5418313aea2 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -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); -- 2.30.2