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: infinite loop in -m=2 #35518
Comments
Further simplified:
|
And here's a loop involving multiple nodes:
|
Interestingly, esc.go -m=2 doesn't seem to have printed an explanation for either of these cases, because they're "moved to heap" escapes rather than "escapes to heap". |
Go 1.13 didn't print anything useful about why these variables were heap allocated, so I don't think it's release critical that Go 1.14 print anything useful for them either. But it is release critical to not infinite loop compiling with -m=2. Properly handling loops like this will require a bit more restructuring to the walk code, which I don't feel comfortable doing this late in the release. I'm inclined to simply detect that we've hit a loop, print a warning that the path is incomplete, and return. We can figure out how to better diagnose these rho-shaped loops in Go 1.15. |
Change https://golang.org/cl/206619 mentions this issue: |
And finally, here's an example where the original node isn't part of the assignment cycle:
Context: I was wondering if CL 206619 was overkill, and I could just check if we loop back to |
This CL detects infinite loops due to negative dereference cycles during escape analysis, and terminates the loop gracefully. We still fail to print a complete explanation of the escape path, but esc.go didn't print *any* explanation for these test cases, so the release blocking issue here is simply that we don't infinite loop. Updates #35518. Change-Id: I39beed036e5a685706248852f1fa619af3b7abbc Reviewed-on: https://go-review.googlesource.com/c/go/+/206619 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Change https://golang.org/cl/206820 mentions this issue: |
Since CL 206619 is submitted, this isn't a release blocker for Go 1.14 anymore. The underlying issue that there can be cycles in the escape path and we should ideally explain that properly is still a concern though. |
Updates #35518. Change-Id: Icd052c8c68aae32696b5831a29e04cc4cb224b06 Reviewed-on: https://go-review.googlesource.com/c/go/+/206820 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This compilation unit goes into an infinite loop when compiled with
-m=2
:Distilled from cmd/compile/internal/gc, pointed out by @dr2chase .
The text was updated successfully, but these errors were encountered: