Skip to content

Commit b7f55c8

Browse files
author
Ian Lance Taylor
committed
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
1 parent 4f0eaba commit b7f55c8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

gcc/go/gofrontend/MERGE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
28c9053b3d507bef7bd56cb01c6b22deea354cdd
1+
17bef47f464983fd8513f88f3f159d28e2423e79
22

33
The first line of this file holds the git revision number of the last
44
merge done from the gofrontend repository.

gcc/go/gofrontend/gogo.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,9 +2589,11 @@ Gogo::define_global_names()
25892589
if (this->is_main_package())
25902590
{
25912591
// Every Go program has to import the runtime package, so that
2592-
// it is properly initialized.
2592+
// it is properly initialized. We can't use
2593+
// predeclared_location here as it will cause runtime functions
2594+
// to appear to be builtin functions.
25932595
this->import_package("runtime", "_", false, false,
2594-
Linemap::predeclared_location());
2596+
this->package_->location());
25952597
}
25962598

25972599
for (Bindings::const_declarations_iterator p =

0 commit comments

Comments
 (0)