I’ve noticed that the __builtin_setjmp function does different things on Clang compared to GCC. On Clang only the stack pointer and frame pointer are saved, while GCC also saves the address that is used to longjmp back. This is causing problems (segfaults) with code compiled using Clang that links with a library built with GCC.
The file /include/clang/Basic/Builtins.def seems to imply that they should be compatible, as __buildin_setjmp is listed under the header “Random GCC Builtins”.
Is this a bug with Clang or the intended behavior?