]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: ignore contentEscapes for marking nodes as escaping
authorKeith Randall <khr@golang.org>
Wed, 7 Sep 2016 04:08:21 +0000 (21:08 -0700)
committerKeith Randall <khr@golang.org>
Wed, 7 Sep 2016 06:59:22 +0000 (06:59 +0000)
Redo of CL 28575 with fixed test.
We're in a pre-KeepAlive world for a bit yet, the old tests
were in a client which was in a post-KeepAlive world.

Change-Id: I114fd630339d761ab3306d1d99718d3cb973678d
Reviewed-on: https://go-review.googlesource.com/28582
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/esc.go
test/live.go
test/live_ssa.go

index c5597d7f487ebefb61587f289bb87683e9b5d249..0fd514fbaf49e5d1c0219a8afd42f521ba9befd5 100644 (file)
@@ -1572,7 +1572,7 @@ func esccall(e *EscState, n *Node, up *Node) {
                }
 
                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
                                for a.Op == OCONVNOP {
                                        a = a.Left
index db47e14e93c2a4d8cd5e6940b347c9f32e484e76..c3985a37a2b783ad90ed0d934ca960f81ba8521e 100644 (file)
@@ -643,3 +643,14 @@ func good40() {
        printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$"
        _ = t
 }
+
+func ddd1(x, y *int) { // ERROR "live at entry to ddd1: x y$"
+       ddd2(x, y) // ERROR "live at call to ddd2: x y autotmp_[0-9]+$"
+       printnl()  // ERROR "live at call to printnl: x y$"
+       // Note: no autotmp live at printnl.  See issue 16996.
+}
+func ddd2(a ...*int) { // ERROR "live at entry to ddd2: a$"
+       sink = a[0]
+}
+
+var sink *int
index 27c4528dc1b022c81c3eeeae4ea4518bacc804ab..41ac407db362db31b28c86cc221f311ca4a77930 100644 (file)
@@ -646,3 +646,12 @@ func good40() {
        printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$"
        _ = t
 }
+
+func ddd1(x, y *int) { // ERROR "live at entry to ddd1: x y$"
+       ddd2(x, y) // ERROR "live at call to ddd2: x y autotmp_[0-9]+$"
+       printnl()  // ERROR "live at call to printnl: x y$"
+       // Note: no autotmp live at printnl.  See issue 16996.
+}
+func ddd2(a ...*int) { // ERROR "live at entry to ddd2: a$"
+       sink = a[0]
+}