Don't crash on erroneous named result.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Mar 2011 00:54:42 +0000 (00:54 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Mar 2011 00:54:42 +0000 (00:54 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170633 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/gogo-tree.cc

index 883b5b1..83488fc 100644 (file)
@@ -1786,8 +1786,14 @@ Function::return_value(Gogo* gogo, Named_object* named_function,
   // defer statements, the result variables may be unnamed.
   bool is_named = !results->front().name().empty();
   if (is_named)
-    gcc_assert(this->named_results_ != NULL
-              && this->named_results_->size() == results->size());
+    {
+      gcc_assert(this->named_results_ != NULL);
+      if (this->named_results_->size() != results->size())
+       {
+         gcc_assert(saw_errors());
+         return error_mark_node;
+       }
+    }
 
   tree retval;
   if (results->size() == 1)