re PR go/61246 (gccgo: ICE in do_determine_types [GoSmith])
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 16 Dec 2014 21:36:53 +0000 (21:36 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 16 Dec 2014 21:36:53 +0000 (21:36 +0000)
PR go/61246
compiler: Switch expression comparisons should be boolean typed.

From-SVN: r218794

gcc/go/gofrontend/statements.cc

index 6094e5c684b6cbb61e24c2fac563b4c5b1554e88..6eb0d7bcc78991e3bdfd8c4153d36f1af5ab3704 100644 (file)
@@ -3857,7 +3857,11 @@ Switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
   Expression* val = this->val_;
   if (val == NULL)
     val = Expression::make_boolean(true, loc);
-  Temporary_statement* val_temp = Statement::make_temporary(NULL, val, loc);
+
+  Type* type = val->type();
+  if (type->is_abstract())
+    type = type->make_non_abstract_type();
+  Temporary_statement* val_temp = Statement::make_temporary(type, val, loc);
   b->add_statement(val_temp);
 
   this->clauses_->lower(b, val_temp, this->break_label());