Skip to content

Commit

Permalink
compiler: Don't crash on invalid array type declarations.
Browse files Browse the repository at this point in the history
Fixes golang/go#12937.

Change-Id: I4ca4e99ce1791b4d3556fc122643a1dc89a752e7
Reviewed-on: https://go-review.googlesource.com/16233
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
Chris Manghane authored and ianlancetaylor committed Jan 26, 2016
1 parent 731941c commit 721c778
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions go/gogo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 721c778

Please sign in to comment.