[cfe-dev] __builtin_setjmp compatability with gcc

Rudderham, Stuart stuart.rudderham at intel.com
Tue Sep 25 11:28:17 PDT 2012

Thanks for the reply. I've filed a bug report here -> http://llvm.org/bugs/show_bug.cgi?id=13918.

- Stuart Rudderham

-----Original Message-----
From: Eli Friedman [mailto:eli.friedman at gmail.com] 
Sent: Monday, September 24, 2012 6:56 PM
To: Rudderham, Stuart
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] __builtin_setjmp compatability with gcc

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.


More information about the cfe-dev mailing list