• Keith Randall's avatar
    cmd/compile: keep heap pointer for escaping output parameters live · 6effdd28
    Keith Randall authored
    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: 's avatarDavid Chase <drchase@google.com>
    6effdd28
issue16095.go 1.89 KB