> Are there any other restrictions? Do they, for example, guarantee to > restore all call-saved registers to their values at the time of the > __builtin_longjmp call, including those for which libc's setjmp and > longjmp need to test for existence at runtime (but they may have been used > in an intermediate stack frame, even if not enabled in either the setjmp > or longjmp frames)?
__builtin_longjmp/__builtin_setjmp don't save or restore anything themselves. They cause the compiler to generate code that saves and restores registers live across the non-local goto paths, but of course only registers known to the compiler and known to be used in the code. > Either you need to document all the semantics so as to make clear to users > exactly when they can use these functions safely, or you need to state > that there are undocumented restrictions that may change from GCC version > to GCC version and that these functions are only intended for internal use > as part of GCC's exception handling implementation. The restrictions have probably not changed since the builtins were invented. -- Eric Botcazou