]> 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 a22e60ef11f61ba2022e9d6c44be66870af8c73c..2cc510beb635df01ae75e92ee06d51212e1ef34d 100644 (file)
@@ -1,6 +1,6 @@
 // errorcheck -0 -d=nil
 
-// +build !wasm
+//go:build !wasm && !aix
 
 // Copyright 2013 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -192,21 +192,6 @@ func f4(x *[10]int) {
        _ = &x[9] // ERROR "removed[a-z ]* nil check"
 }
 
-func f5(p *float32, q *float64, r *float32, s *float64) float64 {
-       x := float64(*p) // ERROR "removed nil check"
-       y := *q          // ERROR "removed nil check"
-       *r = 7           // ERROR "removed nil check"
-       *s = 9           // ERROR "removed nil check"
-       return x + y
-}
-
-type T [29]byte
-
-func f6(p, q *T) {
-       x := *p // ERROR "removed nil check"
-       *q = x  // ERROR "removed nil check"
-}
-
 func m1(m map[int][80]byte) byte {
        v := m[3] // ERROR "removed nil check"
        return v[5]
@@ -228,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
 }
@@ -246,8 +223,8 @@ type TT struct {
 
 func f(t *TT) *byte {
        // See issue 17242.
-       s := &t.SS  // ERROR "removed nil check"
-       return &s.x // ERROR "generated nil check"
+       s := &t.SS  // ERROR "generated nil check"
+       return &s.x // ERROR "removed nil check"
 }
 
 // make sure not to do nil check for newobject
@@ -257,14 +234,23 @@ func f7() (*Struct, float64) {
        return t, *p // ERROR "removed nil check"
 }
 
-// make sure to remove nil check for memory move (issue #18003)
-func f8(t *[8]int) [8]int {
-       return *t // ERROR "removed nil check"
-}
-
 func f9() []int {
        x := new([1]int)
        x[0] = 1  // ERROR "removed nil check"
        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"
+}