aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-12-30 07:08:00 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-12-30 07:08:00 +0000
commit270ca283ffb2fb8ce7cfbb2e07a5edcf42b17592 (patch)
treea30b81143a4f6987754e3d732d5b577b9ff31d73 /gcc
parenta9788936a187733ff74ea43657d190ffc147b3e0 (diff)
downloadgcc-270ca283ffb2fb8ce7cfbb2e07a5edcf42b17592.zip
gcc-270ca283ffb2fb8ce7cfbb2e07a5edcf42b17592.tar.gz
gcc-270ca283ffb2fb8ce7cfbb2e07a5edcf42b17592.tar.bz2
compiler: use more accurate array type in Gogo::register_gc_vars
The length of the roots array in Gogo::register_gc_vars was being computed incorrectly, potentially leading to type clashes in the back end. Compute an accurate length for this array ahead of time. Reviewed-on: https://go-review.googlesource.com/34624 From-SVN: r243974
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/gogo.cc6
2 files changed, 4 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index b9c6280..9392c94 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-9a89f32811e6b3a29e22dda46e9c23811f562876
+d9be5f5d7907cbc169424fe2b8532cc3919cad5b
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 51de428..ff82f11 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -740,9 +740,9 @@ Gogo::register_gc_vars(const std::vector<Named_object*>& var_gc,
"__size", uint_type);
Location builtin_loc = Linemap::predeclared_location();
- Expression* length = Expression::make_integer_ul(var_gc.size(), NULL,
- builtin_loc);
-
+ unsigned roots_len = var_gc.size() + this->gc_roots_.size() + 1;
+ Expression* length = Expression::make_integer_ul(roots_len, NULL,
+ builtin_loc);
Array_type* root_array_type = Type::make_array_type(root_type, length);
Type* ptdt = Type::make_type_descriptor_ptr_type();
Struct_type* root_list_type =