summaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/gogo.cc
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-26 23:28:37 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-26 23:28:37 +0000
commit09a4541b82869fd581e7af72c807720fc90c96cd (patch)
tree57bc3b584cc5debb4b0d25f8d46f35b2e8d3a43b /gcc/go/gofrontend/gogo.cc
parent8abd3d0cf376102991f6bd4aa7af7faf2308138f (diff)
downloadgcc-09a4541b82869fd581e7af72c807720fc90c96cd.tar.gz
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
Diffstat (limited to 'gcc/go/gofrontend/gogo.cc')
-rw-r--r--gcc/go/gofrontend/gogo.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 6708be93cf7..5413cc937fb 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<Type*>::iterator p = this->verify_types_.begin();
+ p != this->verify_types_.end();
+ ++p)
+ Type::traverse(*p, &lower_parse_tree);
}
// Lower a block.