Commit bb2978b8 by Ian Lance Taylor

compiler: Don't make gc symbol for bad array type.

    
    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.
    
    Reviewed-on: https://go-review.googlesource.com/13066

From-SVN: r226825
parent c3d3b30a
55175f7ee0db2c1e68423216d7744be80071ed6c 5fc38e74d132cd6f4e7b56e6bcf9fe57031ab203
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -6423,7 +6423,10 @@ Array_type::array_gc_symbol(Gogo* gogo, Expression_list** vals, ...@@ -6423,7 +6423,10 @@ Array_type::array_gc_symbol(Gogo* gogo, Expression_list** vals,
unsigned long bound; unsigned long bound;
if (!this->length_->numeric_constant_value(&nc) if (!this->length_->numeric_constant_value(&nc)
|| nc.to_unsigned_long(&bound) == Numeric_constant::NC_UL_NOTINT) || 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()); Btype* pbtype = gogo->backend()->pointer_type(gogo->backend()->void_type());
int64_t pwidth = gogo->backend()->type_size(pbtype); int64_t pwidth = gogo->backend()->type_size(pbtype);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment