Debian Codegraph @

test/fixedbugs/issue38496.go

raw
1 // run
2
3 // Copyright 2020 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Make sure bounds check elision isn't confused with nil check elision.
8
9 package main
10
11 func main() {
12 defer func() {
13 err := recover()
14 if err == nil {
15 panic("failed to check nil ptr")
16 }
17 }()
18 var m [2]*int
19 _ = *m[1] // need a nil check, but not a bounds check
20 }