From 02c7e7eb5ed750f8ecebc96a29802cdf54c7f01e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 28 Jul 2017 19:58:01 +0000 Subject: [PATCH] compiler: add backend type conversion 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 struct. Reviewed-on: https://go-review.googlesource.com/51712 From-SVN: r250686 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/expressions.cc | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9dc96cfc100..685cff9935b 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 79a2f524aa7..eb23ec26ecf 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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); -- 2.30.2