-
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: ICE 'invalid defer call' due to CL 479095 #59404
Comments
This appears to be a problem in escape analysis and/or Here is a somewhat smaller example to repro: https://go.dev/play/p/UUFnYaFwv50 Here's what
Note that all of the closures have the "hidden closure" flag set, since they are all reachable from the top level routine Autodetect. Now here's what the same list looks like with inlining turned on:
What's happened here is that when Once the call to Because they are not exposed to escape analysis, the code that canonicalizes go/defer (here) never kicks in, but since the functions are still on the top level Decls list, they still get compiled, thus the assert in walk. Seems to me the best way to handle this would be in escape analysis, I'll look into cooking up a CL of some sort for that. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Change https://go.dev/cl/482355 mentions this issue: |
Change https://go.dev/cl/482715 mentions this issue: |
Change https://go.dev/cl/484859 mentions this issue: |
This patch generalizes the code in the inliner that marks unreferenced hidden closure functions as dead. Rather than doing the marking on the fly (previous approach), this new approach does a single pass at the end of inlining, which catches more dead functions. Fixes #59638. Updates #59404. Updates #59547. Change-Id: I54fd63e9e37c9123b08a3e7def7d1989919bba91 Reviewed-on: https://go-review.googlesource.com/c/go/+/484859 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Change https://go.dev/cl/486377 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Only on tip.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
$ git clone https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver.git
$ cd opencensus-go-exporter-stackdriver
$ git checkout v0.13.5
...
$ go test -race -short ./...
What did you expect to see?
Clean build of test
What did you see instead?
At first blush what appears to be happening is that the code in escape analysis that "normalizes" defers (converts them via wrapping into calls to no-args/no-results functions) is missing a defer. More work needed to find out exactly why.
Note that CL 479095 has since been reverted upstream, so the bug will no longer manifest directly on tip.
The text was updated successfully, but these errors were encountered: