Skip to content

Commit

Permalink
compiler: Don't make gc symbol for bad array type.
Browse files Browse the repository at this point in the history
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.

Change-Id: Ife196c04ad7c8484dc3840360b9373ee017d41d3
Reviewed-on: https://go-review.googlesource.com/13066
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
Chris Manghane authored and ianlancetaylor committed Aug 12, 2015
1 parent 55175f7 commit 5fc38e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion go/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5fc38e7

Please sign in to comment.