Source file test/fixedbugs/issue80127.go

     1  // run
     2  
     3  // Copyright 2026 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  type T [2][2]int64
    10  
    11  //go:noinline
    12  func f(i, j int) int64 {
    13  	if i < 0 || i > 1 || j < 0 || j > 1 {
    14  		return 3
    15  	}
    16  	var x T
    17  	x[i][i] = 33
    18  
    19  	var y T
    20  	y[i][i] = 44
    21  	r := y[j][j]
    22  
    23  	return r + x[i][i]
    24  }
    25  
    26  func main() {
    27  	if x := f(1, 1); x != 77 {
    28  		println("bad", x)
    29  	}
    30  }
    31  

View as plain text