This patch to the Go frontend by Than McIntosh tweaks 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. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 250683) +++ gcc/go/gofrontend/MERGE (working copy) @@ -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: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 250682) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -12057,12 +12057,15 @@ Interface_field_reference_expression::do 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);