summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-07-23 00:34:38 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-07-23 00:34:38 +0000
commit1d46067b347ab1814de3cdd7f620f5c8ca73232a (patch)
tree347f784d5b19e1702eed59c9479fec0c5496c742
parent22e4efa142acc9c7cdabc4ace27e306b8e807a56 (diff)
downloadgcc-1d46067b347ab1814de3cdd7f620f5c8ca73232a.tar.gz
compiler: follow-on fix for finalizing imported methods
This patch is a revision to CL 185518, which added code to perform finalization of methods on types created by the importer and not directly reachable until inlining is done. The original fix invoked the finalization code at the end of Import::read_types(), but it turns out this doesn't handle the case where a type with methods is read in due to a reference from something later in the export data (a function or variable). The fix is to move the import finalization call to the end of Import::import(). Testcase for this bug is in CL 187057. Fixes golang/go#33219. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/187058 From-SVN: r273713
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/import.cc14
2 files changed, 9 insertions, 7 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 2c536025f28..dabd5a30989 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-e242929304e7a524ced56dc94605bbf6d83e6489
+b7bce0dbccb978d33eb8ce0bffc02fae2c2857c1
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc
index be71f041050..64c1ef2d9e3 100644
--- a/gcc/go/gofrontend/import.cc
+++ b/gcc/go/gofrontend/import.cc
@@ -450,6 +450,14 @@ Import::import(Gogo* gogo, const std::string& local_name,
this->require_c_string("\n");
}
+ // Finalize methods for any imported types. This call is made late in the
+ // import process so as to A) avoid finalization of a type whose methods
+ // refer to types that are only partially read in, and B) capture both the
+ // types imported by read_types() directly, and those imported indirectly
+ // because they are referenced by an imported function or variable.
+ // See issues #33013 and #33219 for more on why this is needed.
+ this->finalize_methods();
+
return this->package_;
}
@@ -678,12 +686,6 @@ Import::read_types()
this->gogo_->add_named_type(nt);
}
- // Finalize methods for any imported types. This is done after most of
- // read_types() is complete so as to avoid method finalization of a type
- // whose methods refer to types that are only partially read in.
- // See issue #33013 for more on why this is needed.
- this->finalize_methods();
-
return true;
}