Go patch committed: Don't crash on erroneous var init from receive

Submitted by Ian Taylor on Dec. 22, 2010, 4:38 p.m.

Details

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

Commit Message

Ian Taylor Dec. 22, 2010, 4:38 p.m.
This patch to the Go frontend avoids a compiler crash when a variable is
initialized from a channel receive but the receive turns out to be
erroneous.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch hide | download patch | download mbox

diff -r da6d9ff631bd go/gogo.cc
--- a/go/gogo.cc	Wed Dec 22 08:27:02 2010 -0800
+++ b/go/gogo.cc	Wed Dec 22 08:35:00 2010 -0800
@@ -3165,7 +3165,7 @@ 
     {
       Expression* channel = expr->receive_expression()->channel();
       Type* channel_type = channel->type();
-      if (channel_type->is_error_type())
+      if (channel_type->channel_type() == NULL)
 	return Type::make_error_type();
       return channel_type->channel_type()->element_type();
     }