-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: compiler does not see that string escapes via function literal #14409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks like an escape analysis bug to me also. Simpler repro:
In f, the compiler decides to pass a temporary stack buffer to concatstring2. It shouldn't, as the resulting string is returned via a tortuous path through z. |
CL https://golang.org/cl/20102 mentions this issue. |
CL https://golang.org/cl/22050 mentions this issue. |
As noted on the cherry pick CL for 1.6.2, this doesn't build as it depends on 2d56dee, a much more substantial piece of work. For this to make it into 1.6.2 it needs a specially authored patch. |
Missed a case for closure calls (OCALLFUNC && indirect) in esc.go:esccall. Cleanup to runtime code for windows to more thoroughly hide a technical escape. Also made code pickier about failing to late non-optional kernel32.dll. Revised for 1.6.2 Fixes #14409. Change-Id: Ie75486a2c8626c4583224e02e4872c2875f7bca5 Reviewed-on: https://go-review.googlesource.com/22050 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Hi, I am attaching a test case which fails on OSX El Capitan after upgrading go to version 1.6
The first call to the
badFunc
illustrates that the code works when the string returned by thebadFunc
is equal or longer than 32 bytes. For shorter strings it fails.When I shuffle the code around, the returned bytes are bit different.
When I call the
NewError([something shorter than 32 bytes])
it returns expected results.Results:
The text was updated successfully, but these errors were encountered: