cmd/compile: stack overflow accessing large return value #14028
Taken this toy example, that calculates prime numbers: http://play.golang.org/p/XrUCUvC7In
Building this with go build -gcflags -m shows following outputmoved to heap: arr moved to heap: x
However, running the program I get following error:
runtime: goroutine stack exceeds 1000000000-byte limit
goroutine 1 [stack growth]:
Is it supposed to get a stackoverflow, if it is a heap object?
Go version: go1.5.3 windows/amd64
The text was updated successfully, but these errors were encountered:
Did you know that
Per the Go ABI, the return value will be passed on stack,
Discussion about the
The issue seems to be that when we're warning about stack frames that are >1GB, we're failing to include the space reserved for calling other functions. In the example above, main needs to allocate 1GB of stack space for fn's return values, but we're not including that space in the test.