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 <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/test/nilptr3_ssa.go b/test/nilptr3_ssa.go
index 0974a84..af11865 100644
--- a/test/nilptr3_ssa.go
+++ b/test/nilptr3_ssa.go
@@ -226,3 +226,11 @@
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"
+}