compiler: add backend type conversion
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 28 Jul 2017 19:58:01 +0000 (19:58 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 28 Jul 2017 19:58:01 +0000 (19:58 +0000)
    Tweak Interface_field_reference_expression::do_get_backend to apply an
    additional backend type conversion to the returned result.  This is
    needed due to the fact that the top level type of the expression is a
    function descriptor, however the value being manufactured is a pointer
    to <thunk-descriptor, value> struct.

    Reviewed-on: https://go-review.googlesource.com/51712

From-SVN: r250686

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc

index 9dc96cfc1000be581706aa8bc53edfc96090cd7c..685cff9935bc6a6bb40e4dd28a749375cc8d2fc2 100644 (file)
@@ -1,4 +1,4 @@
-2118958321532352c91fd9406f571f8729a791cd
+f7c36b27a49131f60eedde260896d310d735d408
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 79a2f524aa734568c9163e196e05facc825ec3ac..eb23ec26ecf88ec630d3b901cec8bbe38782e5d2 100644 (file)
@@ -12057,12 +12057,15 @@ Interface_field_reference_expression::do_get_backend(Translate_context* context)
   Bexpression* bclosure =
     Expression::make_heap_expression(expr, loc)->get_backend(context);
 
+  Gogo* gogo = context->gogo();
+  Btype* btype = this->type()->get_backend(gogo);
+  bclosure = gogo->backend()->convert_expression(btype, bclosure, loc);
+
   Expression* nil_check =
       Expression::make_binary(OPERATOR_EQEQ, this->expr_,
                               Expression::make_nil(loc), loc);
   Bexpression* bnil_check = nil_check->get_backend(context);
 
-  Gogo* gogo = context->gogo();
   Bexpression* bcrash = gogo->runtime_error(RUNTIME_ERROR_NIL_DEREFERENCE,
                                            loc)->get_backend(context);