diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-10-16 18:57:14 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-10-16 18:57:14 +0000 |
commit | f6e31dffc122fc91ca33a9b43ab8b5051585b979 (patch) | |
tree | 784838da9049089f0655c2c0f875f38de2e865e3 /gcc/go | |
parent | 960224c3b740cedfefc3efeb3a19fa5f72d93051 (diff) | |
download | gcc-f6e31dffc122fc91ca33a9b43ab8b5051585b979.zip gcc-f6e31dffc122fc91ca33a9b43ab8b5051585b979.tar.gz gcc-f6e31dffc122fc91ca33a9b43ab8b5051585b979.tar.bz2 |
compiler: Check for initialization cycles in bound method expressions.
Fixes issue 7961.
From-SVN: r216342
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 4c7eca4b..02a9806 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<Seen_objects::iterator, bool> ins = |