[cfe-dev] __builtin_setjmp compatability with gcc

Eli Friedman eli.friedman at gmail.com
Mon Sep 24 15:56:17 PDT 2012


On Mon, Sep 24, 2012 at 9:42 AM, Rudderham, Stuart
<stuart.rudderham at intel.com> wrote:
> Hi,
>
>
>
> 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?

Sounds like a bug; __builtin_setjmp is supposed to be gcc-compatible,
although I don't think it gets much testing.

-Eli




More information about the cfe-dev mailing list