diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-09 19:41:05 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-09 19:41:05 +0000 |
commit | b7f55c8e35981c5f2cb7c65d7d69f58e02ab0bcd (patch) | |
tree | 0c66de448e004c928c6b138b17ca7d331c73e72d /gcc | |
parent | 4f0eaba24dfb46dd4b45251231fdf006a70888c5 (diff) | |
download | gcc-b7f55c8e35981c5f2cb7c65d7d69f58e02ab0bcd.zip gcc-b7f55c8e35981c5f2cb7c65d7d69f58e02ab0bcd.tar.gz gcc-b7f55c8e35981c5f2cb7c65d7d69f58e02ab0bcd.tar.bz2 |
compiler: don't use predeclared location for implicit runtime import
For the main package we add an implicit import of the runtime package,
to ensure that it is initialized. That import used the predeclared
location, which caused various tests, notably Named_type::is_builtin,
to treat these imported names as builtin. Start using a real location,
so that those tests do the right thing.
By the way, this implicit import is a partial cause of golang/go#19773.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194337
From-SVN: r275540
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index d966638..79349d7 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -28c9053b3d507bef7bd56cb01c6b22deea354cdd +17bef47f464983fd8513f88f3f159d28e2423e79 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/gogo.cc b/gcc/go/gofrontend/gogo.cc index d39a4fb..f6a8e7a 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -2589,9 +2589,11 @@ Gogo::define_global_names() if (this->is_main_package()) { // Every Go program has to import the runtime package, so that - // it is properly initialized. + // it is properly initialized. We can't use + // predeclared_location here as it will cause runtime functions + // to appear to be builtin functions. this->import_package("runtime", "_", false, false, - Linemap::predeclared_location()); + this->package_->location()); } for (Bindings::const_declarations_iterator p = |