llvm-gcc4 and setjmp

Hi,

I’m using LLVM 2.0 on cygwin and x86_64-linux-gnu. If I compile a simple program using setjmp:

#include <setjmp.h>
extern jmp_buf j;
extern void g(void);
int f(void)
{
volatile int v = 0;
if (setjmp(j))
return v;
v = 1;
g();
return 0;
}

the resulting bitcode doesn’t use LLVM’s exception handling intrinsics, it just has a call to a function called “_setjmp”. And there doesn’t seem to be any provision for returning the current value of the volatile variable v if setjmp returns non-zero - the bitcode always returns zero, whereas the spec for setjmp() says that f() should return 1 if g() does a longjmp().

If I change my program to call __builtin_setjmp() explicitly, instead of setjmp(), the resulting bitcode has optimised the call away as if it always returned zero.

So is setjmp supported at all with llvm-gcc4? I couldn’t see anything in the release notes saying that it isn’t.

Thanks,
Jay.