|
From: | Paul Eggert |
Subject: | Re: stack bounds |
Date: | Tue, 22 Sep 2020 18:28:14 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 9/22/20 5:58 PM, Bruno Haible wrote:
It sounds what you want is a function that returns the stack bounds, in such a way that every recursion step in a recursive function call the code can ask "am I close to the stack bound? do I need to stop recursing?"
That shouldn't be necessary, except for functions where GCC can't prove that their activation records are small (and these exceptions should be quite rare at runtime).
I am thinking of some combination of gcc -fstack-check and/or -fstack-clash-protection and/or related ideas (not that I've looked into all the details). That is, I'm expecting help from the hardware, the kernel, and from GCC. Stack-exhaustion checking should "just work". I realize it's a nontrivial ask.
[Prev in Thread] | Current Thread | [Next in Thread] |