| Issue |
170023
|
| Summary |
Stack overflow check mechanism before calling a recursive function
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
rsashka
|
The stack size is always limited to a certain value, and overflowing it causes a segmentation fault, which crashes the application.
While this is rare, it can occur with large amounts of local function data and/or a large number of nested (recursive) calls.
Since segmentation faults cannot be handled from a running application, the only way to handle a stack overflow error is to increase the stack size "with reserve."
I propose adding a mechanism for automatically or manually checking the remaining stack size before calling a recursive function to ensure there is sufficient free space to accommodate the local variables of the called function. If there is insufficient stack space, a regular exception is raised, preventing a segmentation fault due to stack overflow.
Even a manual check before calling recursive functions would be useful, so that instead of crashing the application, a regular exception can be raised, which can be caught and handled internally without crashing.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs