mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: fix lexical scope of escaped variables
When a local variable is moved to the heap the declaration position should be preserved so that later on we can assign it to the correct DW_TAG_lexical_block. Fixes #20959 Change-Id: I3700ef53c68ccd506d0633f11374ad88a52b2898 Reviewed-on: https://go-review.googlesource.com/47852 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
123fd4640a
commit
6f83b75be2
2 changed files with 12 additions and 0 deletions
|
|
@ -2100,6 +2100,7 @@ func moveToHeap(n *Node) {
|
|||
heapaddr := temp(types.NewPtr(n.Type))
|
||||
heapaddr.Sym = lookup("&" + n.Sym.Name)
|
||||
heapaddr.Orig.Sym = heapaddr.Sym
|
||||
heapaddr.Pos = n.Pos
|
||||
|
||||
// Unset AutoTemp to persist the &foo variable name through SSA to
|
||||
// liveness analysis.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue