1// compile
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 genChecker0
10
11var FailCount int
12
13//go:noinline
14func NoteFailure(fidx int, pkg string, pref string, parmNo int, _ uint64) {
15	FailCount += 1
16	if FailCount > 10 {
17		panic("bad")
18	}
19}
20
21//go:noinline
22func NoteFailureElem(fidx int, pkg string, pref string, parmNo int, elem int, _ uint64) {
23	FailCount += 1
24	if FailCount > 10 {
25		panic("bad")
26	}
27}
28
29type StructF0S0 struct {
30	F0 int16
31	F1 string
32	F2 StructF0S1
33}
34
35type StructF0S1 struct {
36	_ uint16
37}
38
39// 0 returns 3 params
40//go:registerparams
41//go:noinline
42func Test0(p0 uint32, p1 StructF0S0, p2 int32) {
43	// consume some stack space, so as to trigger morestack
44	var pad [256]uint64
45	pad[FailCount]++
46	if p0 == 0 {
47		return
48	}
49	p1f0c := int16(-3096)
50	if p1.F0 != p1f0c {
51		NoteFailureElem(0, "genChecker0", "parm", 1, 0, pad[0])
52		return
53	}
54	p1f1c := "f6ꂅ8ˋ<"
55	if p1.F1 != p1f1c {
56		NoteFailureElem(0, "genChecker0", "parm", 1, 1, pad[0])
57		return
58	}
59	p1f2c := StructF0S1{}
60	if p1.F2 != p1f2c {
61		NoteFailureElem(0, "genChecker0", "parm", 1, 2, pad[0])
62		return
63	}
64	p2f0c := int32(496713155)
65	if p2 != p2f0c {
66		NoteFailureElem(0, "genChecker0", "parm", 2, 0, pad[0])
67		return
68	}
69	// recursive call
70	Test0(p0-1, p1, p2)
71	return
72	// 0 addr-taken params, 0 addr-taken returns
73}
74