1 // errorcheck -0 -d=nil
5 // Copyright 2018 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
9 // Test that nil checks are removed.
10 // Optimization is enabled.
14 func f5(p *float32, q *float64, r *float32, s *float64) float64 {
15 x := float64(*p) // ERROR "generated nil check"
16 y := *q // ERROR "generated nil check"
17 *r = 7 // ERROR "generated nil check"
18 *s = 9 // ERROR "generated nil check"
25 x := *p // ERROR "generated nil check"
26 *q = x // ERROR "generated nil check"
29 // make sure to remove nil check for memory move (issue #18003)
30 func f8(t *[8]int) [8]int {
31 return *t // ERROR "generated nil check"