diff mbox

Go patch committed: use correct backend type for Type::gc_symbol_pointer

Message ID CAOyqgcUZtS-gj-vy+pYY+CKsnqnx+9SyBT8qzg2afDh9wo41KA@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Dec. 30, 2016, 6:03 p.m. UTC
This patch by Than McIntosh fixes the Go frontend to wrap the return
from Type::gc_symbol_pointer with a type conversion to uintptr, since
the values returned are stored into structure fields with that type.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian
diff mbox

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 243974)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-d9be5f5d7907cbc169424fe2b8532cc3919cad5b
+ebe9d824adca053066837b8b19461048ced34aff
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 243899)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -2138,7 +2138,10 @@  Type::gc_symbol_pointer(Gogo* gogo)
   Location bloc = Linemap::predeclared_location();
   Bexpression* var_expr =
       gogo->backend()->var_expression(t->gc_symbol_var_, VE_rvalue, bloc);
-  return gogo->backend()->address_expression(var_expr, bloc);
+  Bexpression* addr_expr =
+      gogo->backend()->address_expression(var_expr, bloc);
+  Btype* ubtype = Type::lookup_integer_type("uintptr")->get_backend(gogo);
+  return gogo->backend()->convert_expression(ubtype, addr_expr, bloc);
 }
 
 // A mapping from unnamed types to GC symbol variables.