]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Don't crash on erroneous channel send or receive.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 22 Dec 2010 16:27:51 +0000 (16:27 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 22 Dec 2010 16:27:51 +0000 (16:27 +0000)
From-SVN: r168174

gcc/go/gofrontend/gogo-tree.cc

index 5a6f0792fcc8bb6e2b17ffbbc726701ce1c4e7b4..a5fb5f67589219b1c076948ee81a85ff624005da 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))