]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: only import variable into . if same package
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 3 Sep 2019 23:35:13 +0000 (23:35 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 3 Sep 2019 23:35:13 +0000 (23:35 +0000)
    If we dot-import a package, we should only add an imported variable to
    the package bindings if the variable is in the package being imported.
    A test case for this is the 1.13 os package, in which ErrClosed and
    friends are defined both locally and in the imported internal/oserror package.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192718

From-SVN: r275358

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/import.cc

index 0add2f0a9ae4e7c668fdb084facfef21dd78fb5d..b334136cab8687620a2f9c5cb82c05672fb907b7 100644 (file)
@@ -1,4 +1,4 @@
-3b8a505824abb2a69f4c04c555a4ba29ab8b102b
+ca0fdb4c7735a648b8f10f1248631adf9afb8454
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 64c1ef2d9e3e7ec127c060deb9a6b7c094b2c58f..bbc8d7d9930cbdea56406c970aba9a0974c67084 100644 (file)
@@ -777,7 +777,7 @@ Import::import_var()
                               this->location_);
   Named_object* no;
   no = vpkg->add_variable(name, var);
-  if (this->add_to_globals_)
+  if (this->add_to_globals_ && vpkg == this->package_)
     this->gogo_->add_dot_import_object(no);
 }