1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include "libgo9.h"
6
7 void use(int *x) { (*x)++; }
8
9 void callGoFWithDeepStack(int p) {
10 int x[10000];
11
12 use(&x[0]);
13 use(&x[9999]);
14
15 GoF(p);
16
17 use(&x[0]);
18 use(&x[9999]);
19 }
20
21 void callGoWithVariousStack(int p) {
22 GoF(0); // call GoF without using much stack
23 callGoFWithDeepStack(p); // call GoF with a deep stack
24 GoF(0); // again on a shallow stack
25 }
26
27 int main() {
28 callGoWithVariousStack(0);
29
30 callGoWithVariousStackAndGoFrame(0); // normal execution
31 callGoWithVariousStackAndGoFrame(1); // panic and recover
32 }
33
View as plain text