* Go patch committed: Correct handling of methods which call recover
@ 2010-12-21 22:40 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-21 22:40 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
The complicated dance that the Go frontend does to handle functions
which call recover had some bugs when dealing with a method call. This
patch fixes those bugs. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: recover --]
[-- Type: text/x-diff, Size: 1668 bytes --]
diff -r cf19102d606a go/expressions.cc
--- a/go/expressions.cc Tue Dec 21 12:30:43 2010 -0800
+++ b/go/expressions.cc Tue Dec 21 13:04:41 2010 -0800
@@ -8630,6 +8630,7 @@
pe != this->args_->end();
++pe, ++pp, ++i)
{
+ gcc_assert(pp != params->end());
tree arg_val = (*pe)->get_tree(context);
args[i] = Expression::convert_for_assignment(context,
pp->type(),
diff -r cf19102d606a go/gogo.cc
--- a/go/gogo.cc Tue Dec 21 12:30:43 2010 -0800
+++ b/go/gogo.cc Tue Dec 21 13:04:41 2010 -0800
@@ -2093,14 +2093,6 @@
Expression* fn = Expression::make_func_reference(new_no, closure, location);
Expression_list* args = new Expression_list();
- if (orig_fntype->is_method())
- {
- Named_object* rec_no = gogo->lookup(receiver_name, NULL);
- gcc_assert(rec_no != NULL
- && rec_no->is_variable()
- && rec_no->var_value()->is_parameter());
- args->push_back(Expression::make_var_reference(rec_no, location));
- }
if (new_params != NULL)
{
// Note that we skip the last parameter, which is the boolean
@@ -2153,10 +2145,11 @@
&& !orig_rec_no->var_value()->is_receiver());
orig_rec_no->var_value()->set_is_receiver();
- Named_object* new_rec_no = new_bindings->lookup_local(receiver_name);
+ const std::string& new_receiver_name(orig_fntype->receiver()->name());
+ Named_object* new_rec_no = new_bindings->lookup_local(new_receiver_name);
gcc_assert(new_rec_no != NULL
&& new_rec_no->is_variable()
- && !new_rec_no->var_value()->is_receiver());
+ && new_rec_no->var_value()->is_receiver());
new_rec_no->var_value()->set_is_not_receiver();
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-21 21:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-21 22:40 Go patch committed: Correct handling of methods which call recover Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).