Don't crash on erroneous named result.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 3 Mar 2011 00:54:42 +0000 (00:54 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 3 Mar 2011 00:54:42 +0000 (00:54 +0000)
From-SVN: r170633

gcc/go/gofrontend/gogo-tree.cc

index 883b5b118469f7abf7ef28198f6781b19164f9aa..83488fc83e7e282033ab7e6d06da83092c42d500 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)