This Go frontend patch by Than McIntosh fixes inlining of sink names. When the compiler writes an inlinable function to the export data, parameter names are written out (in Export::write_name) using the Gogo::message_name as opposed to a raw/encoded name. This means that sink parameters (those named "_") get created with the name "_" instead of "._" (the name created by the lexer/parser). This confuses Gogo::is_sink_name, which looks for the latter sequence and not just "_". This can cause issues later on if an inlinable function is imported and fed through the rest of the compiler (things that are sinks are no recognized as such). To fix these issues, change Gogo::is_sink_name to return true for either variants ("_" or "._"). This fixes https://golang.org/issue/35586. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 277299) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -1e2d98b27701744cf0ec57b19d7fc8f594184b9a +2d0504236c7236345ee17a0cb43a3bb9ce3acf7f 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.h =================================================================== --- gcc/go/gofrontend/gogo.h (revision 277299) +++ gcc/go/gofrontend/gogo.h (working copy) @@ -222,7 +222,9 @@ class Gogo { return (name[0] == '.' && name[name.length() - 1] == '_' - && name[name.length() - 2] == '.'); + && name[name.length() - 2] == '.') + || (name[0] == '_' + && name.length() == 1); } // Helper used when adding parameters (including receiver param) to the