diff mbox

Go patch committed: Add backend type conversion for type assertion

Message ID CAOyqgcVqoQG8cz+v6J7WM=3Cb6Q+VzgbtUpbTRYEh7MMnPSQ4w@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor July 20, 2017, 7:53 p.m. UTC
The current recipe in Type_guard_expression for creating a Bexpression
performs a type conversion at the Type level, but doesn't invoke
Backend::convert_expression to capture the conversion for the back
end. This patch by Than McIntosh adds code to create a BE type
conversion operation.  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 250327)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-3d9ff9bc339942922f1be3bef07c6fe2978ad81a
+6572f7e35f962bdb8a7c174920dbb70350b96874
 
 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 250327)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -14307,7 +14307,10 @@  Type_guard_expression::do_get_backend(Tr
         Expression::convert_for_assignment(context->gogo(), this->type_,
                                            this->expr_, this->location());
 
-  return conversion->get_backend(context);
+  Gogo* gogo = context->gogo();
+  Btype* bt = this->type_->get_backend(gogo);
+  Bexpression* bexpr = conversion->get_backend(context);
+  return gogo->backend()->convert_expression(bt, bexpr, this->location());
 }
 
 // Dump ast representation for a type guard expression.