compiler: add explicit convert in Type_guard_expression::do_get_backend
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 20 Jul 2017 19:53:54 +0000 (19:53 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 20 Jul 2017 19:53:54 +0000 (19:53 +0000)
    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. Add code to create a BE type conversion operation.

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

From-SVN: r250400

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

index f6d7a002cbf17e1fa028a35164a1c7426843bfb6..5f624b4b795d24a6265de024ad59768c6e878449 100644 (file)
@@ -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 597f0a0daef26c29aa0186c3c1a6b8ee11a2383d..96a0731c222ce122adc340545ea09d828b7685e9 100644 (file)
@@ -14307,7 +14307,10 @@ Type_guard_expression::do_get_backend(Translate_context* context)
         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.