diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-01-27 00:00:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-01-27 00:00:58 +0000 |
commit | 82c1a217fe9478361b91ebb8514282b729467991 (patch) | |
tree | 80bd8946c4ac76cdafc574db3e15c2d749263a27 | |
parent | 7c97a53ac2991e7804c72b4a168773212307db3b (diff) | |
download | gcc-82c1a217fe9478361b91ebb8514282b729467991.zip gcc-82c1a217fe9478361b91ebb8514282b729467991.tar.gz gcc-82c1a217fe9478361b91ebb8514282b729467991.tar.bz2 |
compiler: Don't crash on erroneous array return types.
Another issue with erroneous array types. When an erroneous array
type is in a function's signature, particularly the return type, we
must guarantee that type is changed into an error type. Otherwise,
any operations that work on arrays and slices will crash when applied
to the erroneous array return type.
Fixes golang/go#12939.
Reviewed-on: https://go-review.googlesource.com/16235
From-SVN: r232858
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 96a1e9f..8ece73d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -721c778adb8f99d8a6b7795dbad86013ccc9ba91 +9e68d67d65fd72b9b4f163f2f26e15cd0d3e2cd2 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/parse.cc b/gcc/go/gofrontend/parse.cc index 9d6a8c6..5c49370 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -419,6 +419,8 @@ Parse::array_type(bool may_use_ellipsis) } Type* element_type = this->type(); + if (element_type->is_error_type()) + return Type::make_error_type(); return Type::make_array_type(element_type, length); } |