-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/compile: memory corruption when setting outer values in functional iterators #70035
Comments
cc @golang/compiler |
Playground version: https://go.dev/play/p/SrpUKjbzHq4 |
Curiously enough, changing joined = joined + "_" + stringValue to joined += "_" + stringValue Seems to avoid this problem - maybe that's a clue? |
It seems that currently nested rangefunc, function inline and escape analysis do not work well together. I can reproduce this problem on the master branch code using the following code:
But, you can avoid this problem, by |
I suspect this involves outlives and containsClosure in escape/solve.go and I am looking there. |
This seems to be the nested rangefunc name generation. For example, the parent is |
I think I have a fix, sorry. I just make an explicit parent pointer, initialize it in deadlocals, use that. |
Change https://go.dev/cl/622715 mentions this issue: |
Ops, I have sent https://go-review.googlesource.com/c/go/+/622715. Feel free to abadon if you prefer your fix. |
Change https://go.dev/cl/622656 mentions this issue: |
@dr2chase @randall77 Should we backport this? |
Probably. This causes a serious miscompilation in certain range-over-func situations. |
Backport issue(s) opened: #70198 (for 1.23). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Go version
go version go1.23.2 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Wrote and ran this test
What did you see happen?
What did you expect to see?
I expected not to see a result that contained uninitialized memory - it's different every time and seems to refer to bad bytes.
The text was updated successfully, but these errors were encountered: