]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: make sure output params are live if there is a defer
authorKeith Randall <khr@golang.org>
Mon, 30 Jan 2017 22:55:12 +0000 (14:55 -0800)
committerKeith Randall <khr@golang.org>
Fri, 3 Feb 2017 15:21:47 +0000 (15:21 +0000)
commit8179b9b462eb2946de8488a26dca91a89b3d22e6
tree89eef2caba11b63c6f5675794686caa6366b3744
parent12c58bbf81c0feca25292a2291a59e16b5ed00f6
cmd/compile: make sure output params are live if there is a defer

If there is a defer, and that defer recovers, then the caller
can see all of the output parameters.  That means that we must
mark all the output parameters live at any point which might panic.

If there is no defer then this is not necessary.  This is implemented.

We could also detect whether there is a recover in any of the defers.
If not, we would need to mark only output params that the defer
actually references (and the closure mechanism already does that).
This is not implemented.

Fixes #18860.

Change-Id: If984fe6686eddce9408bf25e725dd17fc16b8578
Reviewed-on: https://go-review.googlesource.com/36030
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/ssa.go
test/live.go