This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]