On Sat, 1 Dec 2018, Cary Coutant wrote: > In order to handle arbitrary user input without crashing, perhaps the > demangler should switch from recursive descent parsing to a state > machine, where exhaustion of resources can be handled gracefully.
I've wondered if a GCC C/C++ extension could be defined that means "convert this set of mutually recursive functions into a single function with a state machine that allocates the equivalent of the stack manually". But such an extension would certainly be nontrivial to define. (One use for such an extension would be to avoid the GCC bugs that occasionally get reported of the form "expressions with a million nested pairs of parentheses make the compiler segfault", by using it to avoid recursion in the parsers.) -- Joseph S. Myers jos...@codesourcery.com