From: Ian Lance Taylor Date: Thu, 3 Mar 2011 00:54:42 +0000 (+0000) Subject: Don't crash on erroneous named result. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5ba6ad2d680502d03145325f4b6c68f20b24e9a;p=gcc.git Don't crash on erroneous named result. From-SVN: r170633 --- diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index 883b5b11846..83488fc83e7 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -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)