1 // run -gcflags=-d=maymorestack=main.mayMoreStack
3 // Copyright 2021 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.
7 // Test the maymorestack testing hook by injecting a hook that counts
8 // how many times it is called and checking that count.
24 anotherFunc(wantCount - 1) // -1 because the call to main already counted
27 panic("mayMoreStack not called")
28 } else if count != wantCount {
29 println(count, "!=", wantCount)
30 panic("wrong number of calls to mayMoreStack")
35 func anotherFunc(n int) {
36 // Trigger a stack growth on at least some calls to
37 // anotherFunc to test that mayMoreStack is called outside the
38 // morestack loop. It's also important that it is called
39 // before (not after) morestack, but that's hard to test.