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

     1  // run
     2  
     3  // Copyright 2017 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  // Issue 20811: slice-in-bound check is lowered incorrectly on
     8  // amd64p32.
     9  
    10  package main
    11  
    12  func main() {
    13  	i := g()
    14  	_ = "x"[int32(i)]
    15  	j := g()
    16  	_ = "x"[:int32(j)]
    17  }
    18  
    19  //go:noinline
    20  func g() int64 {
    21  	return 4398046511104
    22  }
    23