]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: keep heap pointer for escaping output parameters live
authorKeith Randall <khr@golang.org>
Sun, 19 Jun 2016 02:40:57 +0000 (19:40 -0700)
committerKeith Randall <khr@golang.org>
Mon, 27 Jun 2016 16:48:48 +0000 (16:48 +0000)
commit6effdd28deec546798c00fd83c2a7b5b328ac5ab
treef940369b805a3f6772353e60f14dae136da5276d
parente96b1ef99bdd18a6f777892008f614a4401d6655
cmd/compile: keep heap pointer for escaping output parameters live

Make sure the pointer to the heap copy of an output parameter is kept
live throughout the function.  The function could panic at any point,
and then a defer could recover.  Thus, we need the pointer to the heap
copy always available so the post-deferreturn code can copy the return
value back to the stack.

Before this CL, the pointer to the heap copy could be considered dead in
certain situations, like code which is reverse dominated by a panic call.

Fixes #16095.

Change-Id: Ic3800423e563670e5b567b473bf4c84cddb49a4c
Reviewed-on: https://go-review.googlesource.com/24213
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/gen.go
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/syntax.go
test/fixedbugs/issue16095.go [new file with mode: 0644]