summaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-07 18:19:19 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-07 18:19:19 +0000
commit788d31c2b22d6c22a14cbb649807f046d510ed16 (patch)
treea7c52d0a34feae2fbabbea1016bdc79829bb0833 /gcc/go/gofrontend
parentf0096913e8cb97fde7b861b6b8d1dcfcb07b87b9 (diff)
downloadgcc-788d31c2b22d6c22a14cbb649807f046d510ed16.tar.gz
compiler: don't double count "." in nested_function_num
Nested functions are named "outerfunc.$nestedN", where N is a number. nested_function_num extracts that number. The name is first passed to unpack_hidden_name, which handles the "." and should result "$nestedN". Don't expect the "." again. This fixes assertion failure when escape analysis is enabled and -fgo-debug-escape is on. The failure looks go1: internal compiler error: in nested_function_num, at go/gofrontend/names.cc:241 0x7bd7d3 Gogo::nested_function_num(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) Reviewed-on: https://go-review.googlesource.com/76213 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254504 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/gofrontend')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/names.cc4
2 files changed, 3 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 79ad326e2c4..7be00931af7 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-1427cedcb0faa627fd89a75e009f7898c25aa86c
+7fd845bd9414c348bfa30bd24aa0bb8e4eebf83a
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/names.cc b/gcc/go/gofrontend/names.cc
index 20f7c57ee49..4353a00ef6a 100644
--- a/gcc/go/gofrontend/names.cc
+++ b/gcc/go/gofrontend/names.cc
@@ -238,8 +238,8 @@ int
Gogo::nested_function_num(const std::string& name)
{
std::string n(Gogo::unpack_hidden_name(name));
- go_assert(n.compare(0, 8, ".$nested") == 0);
- return strtol(n.substr(8).c_str(), NULL, 0);
+ go_assert(n.compare(0, 7, "$nested") == 0);
+ return strtol(n.substr(7).c_str(), NULL, 0);
}
// Return the name to use for a sink function, a function whose name