Go patch committed: Don't use predeclared location for implicit runtime import
diff mbox series

Message ID CAOyqgcWaLM=B3NOCAA6s1jv4k3swNCK=WLQwQQSBgha4GuJPWg@mail.gmail.com
State New
Headers show
Series
  • Go patch committed: Don't use predeclared location for implicit runtime import
Related show

Commit Message

Ian Lance Taylor Sept. 9, 2019, 7:41 p.m. UTC
In the Go frontend, 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.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

Patch
diff mbox series

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 275539)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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.
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc	(revision 275396)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -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 =