diff mbox

Go patch committed: Don't crash if receiver is _

Message ID mcrpqee54hb.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 20, 2012, 11:38 p.m. UTC
If a Go program used a receiver named _ (which indicates an unnamed
variable), the gccgo frontend would crash.  This patch fixes the
problem.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 576165e10507 go/gogo.cc
--- a/go/gogo.cc	Fri Jan 20 15:27:09 2012 -0800
+++ b/go/gogo.cc	Fri Jan 20 15:33:34 2012 -0800
@@ -637,7 +637,8 @@ 
 	  ++count;
 	  name = buf;
 	}
-      block->bindings()->add_variable(name, NULL, this_param);
+      if (!Gogo::is_sink_name(name))
+	block->bindings()->add_variable(name, NULL, this_param);
     }
 
   const Typed_identifier_list* parameters = type->parameters();