[LLVMdev] llvm-gcc4 and setjmp

Anton Korobeynikov asl at math.spbu.ru
Fri Aug 24 03:23:47 PDT 2007


Hello, Jay.

> 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(). 
This seems to be well-known problem with interacting setjmp/longjmp and
optimization passes. Actually, this is LLVM PR1520. The problem is that
setjmp/longjmp changes codeflow in inpredictable manner (especially, if
jump buffer escapes from function). We need some clever idea how to
represent such stuff.

PS: Compiling with -O0 should be easy workaround.

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.





More information about the llvm-dev mailing list