diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-11-15 03:28:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-11-15 03:28:49 +0000 |
commit | f543bdd3f997a82627fee4bd3704dd939ece809d (patch) | |
tree | dbf9c33c59bf0a8dc30cb5e4970d3790d1403db9 /gcc/go | |
parent | 942c4b32b0553378f843e606bb56c417acbdc4be (diff) | |
download | gcc-f543bdd3f997a82627fee4bd3704dd939ece809d.zip gcc-f543bdd3f997a82627fee4bd3704dd939ece809d.tar.gz gcc-f543bdd3f997a82627fee4bd3704dd939ece809d.tar.bz2 |
compiler: fix buglet in function inlining related to 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 "._").
Fixes golang/go#35586.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/207259
From-SVN: r278275
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index c9efcba..84a5db8 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index e742b6e..8b79116 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -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 |