From: ian Date: Tue, 26 Jan 2016 23:28:37 +0000 (+0000) Subject: compiler: Don't crash on invalid array type declarations. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09a4541b82869fd581e7af72c807720fc90c96cd;p=thirdparty%2Fgcc.git compiler: Don't crash on invalid array type declarations. Fixes golang/go#12937. Reviewed-on: https://go-review.googlesource.com/16233 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232857 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9540d16b4c81..96a1e9ffe55d 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -731941c155214d6158fa800e52ab3225c0b55f73 +721c778adb8f99d8a6b7795dbad86013ccc9ba91 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/gogo.cc b/gcc/go/gofrontend/gogo.cc index 6708be93cf72..5413cc937fbe 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -2699,6 +2699,15 @@ Gogo::lower_parse_tree() { Lower_parse_tree lower_parse_tree(this, NULL); this->traverse(&lower_parse_tree); + + // There might be type definitions that involve expressions such as the + // array length. Make sure to lower these expressions as well. Otherwise, + // errors hidden within a type can introduce unexpected errors into later + // passes. + for (std::vector::iterator p = this->verify_types_.begin(); + p != this->verify_types_.end(); + ++p) + Type::traverse(*p, &lower_parse_tree); } // Lower a block.