Source file test/fixedbugs/issue27289.go

     1  // run
     2  
     3  // Copyright 2018 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 we don't prove that the bounds check failure branch is unreachable.
     8  
     9  package main
    10  
    11  //go:noinline
    12  func f(a []int) {
    13  	_ = a[len(a)-1]
    14  }
    15  
    16  func main() {
    17  	defer func() {
    18  		if err := recover(); err != nil {
    19  			return
    20  		}
    21  		panic("f should panic")
    22  	}()
    23  	f(nil)
    24  }
    25  

View as plain text