]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.14] cmd/compile: fix live variable computation for deferreturn
authorKeith Randall <khr@golang.org>
Sat, 8 Aug 2020 14:58:04 +0000 (07:58 -0700)
committerDmitri Shuralyov <dmitshur@golang.org>
Mon, 5 Oct 2020 23:02:02 +0000 (23:02 +0000)
commita4af75d300f31113540bda1b305a9491c057b632
tree69e23aa8ccc797de8ae2da992b4f58badb8b38a4
parent26c6b51bc1b2fdb6f45a8f1b392b9fac78cd955b
[release-branch.go1.14] cmd/compile: fix live variable computation for deferreturn

Taking the live variable set from the last return point is problematic.
See #40629 for details, but there may not be a return point, or it may
be before the final defer.

Additionally, keeping track of the last call as a *Value doesn't quite
work. If it is dead-code eliminated, the storage for the Value is reused
for some other random instruction. Its live variable information,
if it is available at all, is wrong.

Instead, just mark all the open-defer argument slots as live
throughout the function. (They are already zero-initialized.)

Fixes #40647

Change-Id: Ie456c7db3082d0de57eaa5234a0f32525a1cce13
Reviewed-on: https://go-review.googlesource.com/c/go/+/247522
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
(cherry picked from commit 32a84c99e136ed5af0686dbedd31fd7dff40fb38)
Reviewed-on: https://go-review.googlesource.com/c/go/+/248622
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/func.go
test/fixedbugs/issue40629.go [new file with mode: 0644]