1// run 2 3//go:build !wasm 4 5// Copyright 2021 The Go Authors. All rights reserved. 6// Use of this source code is governed by a BSD-style 7// license that can be found in the LICENSE file. 8 9package main 10 11//go:noinline 12func F() { 13 b := g() 14 defer g2(b) 15 n := g()[20] 16 println(n) 17} 18 19type T [45]int 20 21var x = 0 22 23//go:noinline 24func g() T { 25 x++ 26 return T{20: x} 27} 28 29//go:noinline 30func g2(t T) { 31 if t[20] != 1 { 32 println("FAIL", t[20]) 33 } 34} 35 36func main() { F() } 37