]> Cypherpunks repositories - gostls13.git/commitdiff
test: add test for CL 26831
authorCherry Zhang <cherryyz@google.com>
Wed, 17 Aug 2016 14:32:39 +0000 (10:32 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 17 Aug 2016 14:50:34 +0000 (14:50 +0000)
Test nil check removal for access of PAUTOHEAP.

Change-Id: Id739a9cda7cd3ff173bdcccfedcad93ee90711ef
Reviewed-on: https://go-review.googlesource.com/27232
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

test/nilptr3.go
test/nilptr3_ssa.go

index a81efb7d8e40f11a12ef2ece7b401adc003ed512..73e074391b051892610be6b2b42d389d97e92243 100644 (file)
@@ -214,3 +214,11 @@ func p1() byte {
        p := new([100]byte)
        return p[5] // ERROR "removed nil check"
 }
+
+// make sure not to do nil check for access of PAUTOHEAP
+//go:noinline
+func (p *Struct) m() {}
+func c1() {
+       var x Struct
+       func() { x.m() }() // ERROR "removed nil check"
+}
index 0974a84333714df65fe3c8b5ee9a5d38273089fe..af1186579e65759bb883837005f7311468d77cfe 100644 (file)
@@ -226,3 +226,11 @@ func p1() byte {
        p := new([100]byte)
        return p[5] // ERROR "removed nil check"
 }
+
+// make sure not to do nil check for access of PAUTOHEAP
+//go:noinline
+func (p *Struct) m() {}
+func c1() {
+       var x Struct
+       func() { x.m() }() // ERROR "removed nil check"
+}