From b6493d38909bc3ae99d307761baa7643d1e0d5d9 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <ian@gcc.gnu.org>
Date: Tue, 4 Jan 2011 17:42:21 +0000
Subject: [PATCH] Avoid crash when selecting on non-channel.

From-SVN: r168473
---
 gcc/go/gofrontend/statements.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index b5ded99e158c..3498598754a3 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -4165,6 +4165,14 @@ Select_clauses::get_tree(Translate_context* context,
 	  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;
-- 
GitLab