OSDN Git Service

Don't crash on erroneous channel send or receive.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Dec 2010 16:27:51 +0000 (16:27 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Dec 2010 16:27:51 +0000 (16:27 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168174 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/gogo-tree.cc

index 5a6f079..a5fb5f6 100644 (file)
@@ -2895,6 +2895,9 @@ tree
 Gogo::send_on_channel(tree channel, tree val, bool blocking, bool for_select,
                      source_location location)
 {
+  if (channel == error_mark_node || val == error_mark_node)
+    return error_mark_node;
+
   if (int_size_in_bytes(TREE_TYPE(val)) <= 8
       && !AGGREGATE_TYPE_P(TREE_TYPE(val))
       && !FLOAT_TYPE_P(TREE_TYPE(val)))
@@ -3029,6 +3032,9 @@ tree
 Gogo::receive_from_channel(tree type_tree, tree channel, bool for_select,
                           source_location location)
 {
+  if (type_tree == error_mark_node || channel == error_mark_node)
+    return error_mark_node;
+
   if (int_size_in_bytes(type_tree) <= 8
       && !AGGREGATE_TYPE_P(type_tree)
       && !FLOAT_TYPE_P(type_tree))