summaryrefslogtreecommitdiffstats
path: root/test/abi/wrapdefer_largetmp.go
blob: fb6eebaaca19710fd2c46afad448e6278f8c0688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// run

//go:build !wasm
// +build !wasm

// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

//go:noinline
func F() {
	b := g()
	defer g2(b)
	n := g()[20]
	println(n)
}

type T [45]int

var x = 0

//go:noinline
func g() T {
	x++
	return T{20: x}
}

//go:noinline
func g2(t T) {
	if t[20] != 1 {
		println("FAIL", t[20])
	}
}

func main() { F() }