This is the mail archive of the
mailing list for the GCC project.
Go patch committed: Report init cycles in method values
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Thu, 16 Oct 2014 11:57:31 -0700
- Subject: Go patch committed: Report init cycles in method values
- Authentication-results: sourceware.org; auth=none
This patch from Chris Manghane fixes the Go frontend to correctly report
initialization cycles involving method values. He added a test case for
this in the master gc testsuite, which will be copied into the gccgo
testsuite in due course. This is http://golang.org/issue/7961 .
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
diff -r 72bb6aea3991 go/gogo.cc
--- a/go/gogo.cc Thu Oct 16 10:09:29 2014 -0700
+++ b/go/gogo.cc Thu Oct 16 11:55:53 2014 -0700
@@ -953,13 +953,14 @@
- // We traverse the code of any function we see. Note that this
- // means that we will traverse the code of a function whose address
- // is taken even if it is not called.
+ // We traverse the code of any function or bound method we see. Note that
+ // this means that we will traverse the code of a function or bound method
+ // whose address is taken even if it is not called.
Func_expression* fe = e->func_expression();
- if (fe != NULL)
- const Named_object* f = fe->named_object();
+ Bound_method_expression* bme = e->bound_method_expression();
+ if (fe != NULL || bme != NULL)
+ const Named_object* f = fe != NULL ? fe->named_object() : bme->function();
if (f->is_function() && f->package() == NULL)
std::pair<Seen_objects::iterator, bool> ins =