This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Avoid crash when selecting on non-channel
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 04 Jan 2011 09:42:24 -0800
- Subject: Go patch committed: Avoid crash when selecting on non-channel
This patch to the Go frontend avoids a compiler crash when a select
statement is used with a send or receive with some value that is not a
channel. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
diff -r f59f14d1d82a go/statements.cc
--- a/go/statements.cc Thu Dec 23 17:25:38 2010 -0800
+++ b/go/statements.cc Tue Jan 04 07:34:25 2011 -0800
@@ -4165,6 +4165,14 @@
continue;
}
+ if (p->channel()->type()->channel_type() == NULL)
+ {
+ // We should have given an error in the send or receive
+ // statement we created via lowering.
+ gcc_assert(saw_errors());
+ return error_mark_node;
+ }
+
tree channel_tree = p->channel()->get_tree(context);
if (channel_tree == error_mark_node)
return error_mark_node;