From b5ba6ad2d680502d03145325f4b6c68f20b24e9a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 3 Mar 2011 00:54:42 +0000 Subject: [PATCH] Don't crash on erroneous named result. From-SVN: r170633 --- gcc/go/gofrontend/gogo-tree.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) -- 2.30.2