]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/nilptr3.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / nilptr3.go
index e0f2ed9767659864be3a37d57701652dcbb5cb6e..2cc510beb635df01ae75e92ee06d51212e1ef34d 100644 (file)
@@ -1,7 +1,6 @@
 // errorcheck -0 -d=nil
 
-// +build !wasm
-// +build !aix
+//go:build !wasm && !aix
 
 // Copyright 2013 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -214,14 +213,6 @@ func p1() 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"
-}
-
 type SS struct {
        x byte
 }
@@ -249,3 +240,17 @@ func f9() []int {
        y := x[:] // ERROR "removed nil check"
        return y
 }
+
+// See issue 42673.
+func f10(p **int) int {
+       return * // ERROR "removed nil check"
+       /* */
+       *p // ERROR "removed nil check"
+}
+
+func f11(x []byte) {
+       p := (*[0]byte)(x)
+       _ = *p // ERROR "generated nil check"
+       q := (*[4]byte)(x)
+       _ = *q // ERROR "removed nil check"
+}