modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue15141.go (about)

     1  // compile
     2  
     3  // Copyright 2016 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 main() {
    10  	a := f(1, 99)
    11  	b := g(0xFFFFFFe, 98)
    12  	c := h(0xFFFFFFe, 98)
    13  	println(a[1], b[1], c[1], a[0xFFFFFFe], b[0xFFFFFFe], c[0xFFFFFFe])
    14  }
    15  
    16  //go:noinline
    17  func f(i, y int) (a [0xFFFFFFF]byte) {
    18  	a[i] = byte(y)
    19  	return
    20  }
    21  
    22  //go:noinline
    23  func g(i, y int) [0xFFFFFFF]byte {
    24  	var a [0xFFFFFFF]byte
    25  	a[i] = byte(y)
    26  	return a
    27  }
    28  
    29  //go:noinline
    30  func h(i, y int) (a [0xFFFFFFF]byte) {
    31  	a[i] = byte(y)
    32  	return a
    33  }