aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-01-04 18:16:17 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-01-04 18:16:17 +0000
commit1b7029893ba1ea62d13a28bf9c1be0d398f718db (patch)
treec4c70746e46a77bfc8fe0917866cc26477dbdaab
parentd996ef705ad98d967f6dae3d6198a09b3ba61c6e (diff)
downloadgcc-1b7029893ba1ea62d13a28bf9c1be0d398f718db.zip
gcc-1b7029893ba1ea62d13a28bf9c1be0d398f718db.tar.gz
gcc-1b7029893ba1ea62d13a28bf9c1be0d398f718db.tar.bz2
Fix building recover thunks which return multiple values.
From-SVN: r168476
-rw-r--r--gcc/go/gofrontend/gogo.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 9e51b63..1b00549 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -2062,7 +2062,7 @@ Build_recover_thunks::function(Named_object* orig_no)
for (Typed_identifier_list::const_iterator p = orig_results->begin();
p != orig_results->end();
++p)
- new_results->push_back(*p);
+ new_results->push_back(Typed_identifier("", p->type(), p->location()));
}
Function_type *new_fntype = Type::make_function_type(NULL, new_params,
@@ -2120,7 +2120,7 @@ Build_recover_thunks::function(Named_object* orig_no)
}
args->push_back(this->can_recover_arg(location));
- Expression* call = Expression::make_call(fn, args, false, location);
+ Call_expression* call = Expression::make_call(fn, args, false, location);
Statement* s;
if (orig_fntype->results() == NULL || orig_fntype->results()->empty())
@@ -2128,7 +2128,14 @@ Build_recover_thunks::function(Named_object* orig_no)
else
{
Expression_list* vals = new Expression_list();
- vals->push_back(call);
+ size_t rc = orig_fntype->results()->size();
+ if (rc == 1)
+ vals->push_back(call);
+ else
+ {
+ for (size_t i = 0; i < rc; ++i)
+ vals->push_back(Expression::make_call_result(call, i));
+ }
s = Statement::make_return_statement(new_func->type()->results(),
vals, location);
}