Source file test/fixedbugs/issue40367.go

     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  package main
     8  
     9  func case1() {
    10  	rates := []int32{1,2,3,4,5,6}
    11  	var sink [6]int
    12  	j := len(sink)
    13  	for star, _ := range rates {
    14  		if star+1 < 1 {
    15  			panic("")
    16  		}
    17  		j--
    18  		sink[j] = j
    19  	}
    20  }
    21  
    22  func case2() {
    23  	i := 0
    24  	var sink [3]int
    25  	j := len(sink)
    26  top:
    27  	j--
    28  	sink[j] = j
    29  	if i < 2 {
    30  		i++
    31  		if i < 1 {
    32  			return
    33  		}
    34  		goto top
    35  	}
    36  }
    37  
    38  func main() {
    39  	case1()
    40  	case2()
    41  }

View as plain text