From: Cherry Zhang Date: Wed, 17 Aug 2016 14:32:39 +0000 (-0400) Subject: test: add test for CL 26831 X-Git-Tag: go1.8beta1~1820 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=04e76f295f434bf1bd5ef3b01eed42b638a8b321;p=gostls13.git test: add test for CL 26831 Test nil check removal for access of PAUTOHEAP. Change-Id: Id739a9cda7cd3ff173bdcccfedcad93ee90711ef Reviewed-on: https://go-review.googlesource.com/27232 Run-TryBot: Cherry Zhang Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/test/nilptr3.go b/test/nilptr3.go index a81efb7d8e..73e074391b 100644 --- a/test/nilptr3.go +++ b/test/nilptr3.go @@ -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" +} diff --git a/test/nilptr3_ssa.go b/test/nilptr3_ssa.go index 0974a84333..af1186579e 100644 --- a/test/nilptr3_ssa.go +++ b/test/nilptr3_ssa.go @@ -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" +}