Commit 923a74ce authored by Keith Randall's avatar Keith Randall

cmd/compile: ignore contentEscapes for marking nodes as escaping

We can still stack allocate and VarKill nodes which don't
escape but their content does.

Fixes #16996

Change-Id: If8aa0fcf2c327b4cb880a3d5af8d213289e6f6bf
Reviewed-on: https://go-review.googlesource.com/28575
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDavid Chase <drchase@google.com>
parent a6edffb2
...@@ -1572,7 +1572,7 @@ func esccall(e *EscState, n *Node, up *Node) { ...@@ -1572,7 +1572,7 @@ func esccall(e *EscState, n *Node, up *Node) {
} }
if haspointers(t.Type) { if haspointers(t.Type) {
if escassignfromtag(e, note, nE.Escretval, src) == EscNone && up.Op != ODEFER && up.Op != OPROC { if escassignfromtag(e, note, nE.Escretval, src)&EscMask == EscNone && up.Op != ODEFER && up.Op != OPROC {
a := src a := src
for a.Op == OCONVNOP { for a.Op == OCONVNOP {
a = a.Left a = a.Left
......
...@@ -643,3 +643,13 @@ func good40() { ...@@ -643,3 +643,13 @@ func good40() {
printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$" printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$"
_ = t _ = t
} }
func ddd1(x, y *int) { // ERROR "live at entry to ddd1: x y$"
ddd2(x, y) // ERROR "live at call to ddd2: autotmp_[0-9]+$"
printnl() // nothing live here. See issue 16996.
}
func ddd2(a ...*int) { // ERROR "live at entry to ddd2: a$"
sink = a[0]
}
var sink *int
...@@ -646,3 +646,11 @@ func good40() { ...@@ -646,3 +646,11 @@ func good40() {
printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$" printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$"
_ = t _ = t
} }
func ddd1(x, y *int) { // ERROR "live at entry to ddd1: x y$"
ddd2(x, y) // ERROR "live at call to ddd2: autotmp_[0-9]+$"
printnl() // nothing live here. See issue 16996.
}
func ddd2(a ...*int) { // ERROR "live at entry to ddd2: a$"
sink = a[0]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment