cmd/compile: open-coded defers keep pointer arguments alive past the deferred call #44623
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
It looks like open-coded defers are keeping their arguments alive past the deferred call:
Failing test case using open-coded defer: https://play.golang.org/p/9SEiOeaLmCS
Passing test case using heap-allocated defer: https://play.golang.org/p/BWEQuC5EowK
In these tests, there are two deferred function calls. The first call needs
p
kept alive, but the second does not. We should be able to collectp
(and run its finalizer) as soon as the first deferred function call returns. The heap-allocated defer does this, but the open-coded one does not./cc @danscales
The text was updated successfully, but these errors were encountered: