Go patch committed: Fix abstract types in temporary statements

Submitted by Ian Taylor on Jan. 4, 2011, 7:02 p.m.

Details

Message ID mcrk4ikpk4l.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Jan. 4, 2011, 7:02 p.m.
This patch to the Go frontend fixes the handling of abstract types in
temporary statements.  We must not let the expression have an abstract
type, even if the temporary statement was created with one.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch hide | download patch | download mbox

diff -r e06d82844ddb go/statements.cc
--- a/go/statements.cc	Tue Jan 04 10:51:43 2011 -0800
+++ b/go/statements.cc	Tue Jan 04 10:59:57 2011 -0800
@@ -340,6 +340,9 @@ 
 void
 Temporary_statement::do_determine_types()
 {
+  if (this->type_ != NULL && this->type_->is_abstract())
+    this->type_ = this->type_->make_non_abstract_type();
+
   if (this->init_ != NULL)
     {
       if (this->type_ == NULL)
@@ -352,10 +355,10 @@ 
     }
 
   if (this->type_ == NULL)
-    this->type_ = this->init_->type();
-
-  if (this->type_->is_abstract())
-    this->type_ = this->type_->make_non_abstract_type();
+    {
+      this->type_ = this->init_->type();
+      gcc_assert(!this->type_->is_abstract());
+    }
 }
 
 // Check types.