From 2922a6cc49dc312f36dbcbe1d6c1790a44fe8af1 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 16 Oct 2014 18:57:14 +0000 Subject: [PATCH] compiler: Check for initialization cycles in bound method expressions. Fixes issue 7961. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216342 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 4c7eca4b247..02a980607fe 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -953,13 +953,14 @@ Find_var::expression(Expression** pexpr) } } - // 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) + Bound_method_expression* bme = e->bound_method_expression(); + if (fe != NULL || bme != NULL) { - const Named_object* f = fe->named_object(); + const Named_object* f = fe != NULL ? fe->named_object() : bme->function(); if (f->is_function() && f->package() == NULL) { std::pair ins = -- 2.11.4.GIT