]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: Change return type comma-ok assignments to untyped bools.
authorIan Lance Taylor <ian@gcc.gnu.org>
Mon, 11 Aug 2014 19:26:26 +0000 (19:26 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 11 Aug 2014 19:26:26 +0000 (19:26 +0000)
Fixes https://code.google.com/p/go/issues/detail?id=8476. The test will be submitted once this is fixed in gc and go/types.

From-SVN: r213832

gcc/go/gofrontend/runtime.cc
gcc/go/gofrontend/statements.cc

index 3b0f1880758cc165022575a346abd5a35e355f39..811c8f5b79f1f9f0b8301e1cbfb09591fc0b5b23 100644 (file)
@@ -24,7 +24,7 @@ enum Runtime_function_type
 {
   // General indicator that value is not used.
   RFT_VOID,
-  // Go type bool, C type _Bool.
+  // Go untyped bool, C type _Bool.
   RFT_BOOL,
   // Go type *bool, C type _Bool*.
   RFT_BOOLPTR,
@@ -93,7 +93,7 @@ runtime_function_type(Runtime_function_type bft)
          go_unreachable();
 
        case RFT_BOOL:
-         t = Type::lookup_bool_type();
+         t = Type::make_boolean_type();
          break;
 
        case RFT_BOOLPTR:
index c407591170a3f95254e89df304ca82c62478e2c8..090c193b8ca45fb9a561ea1b25046c2750d6dd95 100644 (file)
@@ -1150,7 +1150,10 @@ Tuple_map_assignment_statement::do_lower(Gogo*, Named_object*,
 
   // var present_temp bool
   Temporary_statement* present_temp =
-    Statement::make_temporary(Type::lookup_bool_type(), NULL, loc);
+    Statement::make_temporary((this->present_->type()->is_sink_type())
+                             ? Type::make_boolean_type()
+                             : this->present_->type(),
+                             NULL, loc);
   b->add_statement(present_temp);
 
   // present_temp = mapaccess2(DESCRIPTOR, MAP, &key_temp, &val_temp)
@@ -1163,7 +1166,6 @@ Tuple_map_assignment_statement::do_lower(Gogo*, Named_object*,
   Expression* a4 = Expression::make_unary(OPERATOR_AND, ref, loc);
   Expression* call = Runtime::make_call(Runtime::MAPACCESS2, loc, 4,
                                        a1, a2, a3, a4);
-
   ref = Expression::make_temporary_reference(present_temp, loc);
   ref->set_is_lvalue();
   Statement* s = Statement::make_assignment(ref, call, loc);
@@ -1426,7 +1428,10 @@ Tuple_receive_assignment_statement::do_lower(Gogo*, Named_object*,
 
   // var closed_temp bool
   Temporary_statement* closed_temp =
-    Statement::make_temporary(Type::lookup_bool_type(), NULL, loc);
+    Statement::make_temporary((this->closed_->type()->is_sink_type())
+                             ? Type::make_boolean_type()
+                             : this->closed_->type(),
+                             NULL, loc);
   b->add_statement(closed_temp);
 
   // closed_temp = chanrecv2(type, channel, &val_temp)