| | @@ -1,10 +1,13 @@ |
| 1 | 1 | module StackOverflow; |
| 2 | | -(* A recursion with no end runs out of stack: SIGSEGV, said as such *) |
| 2 | +(* A recursion with no end runs out of stack: SIGSEGV, said as such. |
| 3 | + The frame is big so that the fault lands in the prologue, which |
| 4 | + zeroes it from the bottom: with a small one, where the stack starts |
| 5 | + could put the guard page under the body's pushes instead. *) |
| 3 | 6 | |
| 4 | 7 | proc down(n: I64): I64; |
| 5 | | -var pad: [64]I64; |
| 8 | +var pad: [65536]I64; |
| 6 | 9 | begin |
| 7 | | - pad[n mod 64] := n; |
| 10 | + pad[n mod 65536] := n; |
| 8 | 11 | return down(n + 1) + pad[0]; |
| 9 | 12 | end; |
| 10 | 13 | |