Commit 63ba3ad3 by Ian Lance Taylor

compiler: fix off-by-1 array type len in Type::gc_symbol_constructor

    
    Array type being built to hold GC var initializer was being created
    with an extra/unneeded slot. Fix up the code to insure that the array
    length matches the length of the initializer list.
    
    Reviewed-on: https://go-review.googlesource.com/34413

From-SVN: r243731
parent 62afb87d
e807c1deec1e7114bc4757b6193510fdae13e75f ae57b28b3caf1f6670e0f663235f1bf7655db870
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.
...@@ -2261,7 +2261,7 @@ Type::gc_symbol_constructor(Gogo* gogo) ...@@ -2261,7 +2261,7 @@ Type::gc_symbol_constructor(Gogo* gogo)
vals->push_back(Expression::make_integer_ul(GC_END, uintptr_t, bloc)); vals->push_back(Expression::make_integer_ul(GC_END, uintptr_t, bloc));
Expression* len = Expression::make_integer_ul(vals->size() + 1, NULL, Expression* len = Expression::make_integer_ul(vals->size(), NULL,
bloc); bloc);
Array_type* gc_symbol_type = Type::make_array_type(uintptr_t, len); Array_type* gc_symbol_type = Type::make_array_type(uintptr_t, len);
return Expression::make_array_composite_literal(gc_symbol_type, vals, bloc); return Expression::make_array_composite_literal(gc_symbol_type, vals, bloc);
......
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