aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-03-03 00:54:42 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-03-03 00:54:42 +0000
commitb5ba6ad2d680502d03145325f4b6c68f20b24e9a (patch)
treeb6a3c67a3e4a1136c3347ba5c867a8e252f78234 /gcc/go
parent8ca93ccfd2f266eaca01dc053bee934a6b0fb24e (diff)
downloadgcc-b5ba6ad2d680502d03145325f4b6c68f20b24e9a.zip
gcc-b5ba6ad2d680502d03145325f4b6c68f20b24e9a.tar.gz
gcc-b5ba6ad2d680502d03145325f4b6c68f20b24e9a.tar.bz2
Don't crash on erroneous named result.
From-SVN: r170633
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index 883b5b1..83488fc 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)