What would be the best way to convert built-in setjmp and longjmp tp library calls?<br>Should it be implemented in clang or in backends?   <br><br><div class="gmail_quote">On Tue, Apr 12, 2011 at 2:38 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">ARM/Darwin implements them. I'm not aware of any others.<br>
<br>
That said, they are designed for internal use by the compiler for exception handling. Calling them directly like this is very much not recommended. Using the system library setjmp()/longjmp() functions is preferred.<br>
<br>
-Jim<br>
<div><div></div><div class="h5"><br>
On Apr 12, 2011, at 1:56 PM, Akira Hatanaka wrote:<br>
<br>
> Does the X86 backend (or any other backend) correctly implement support for __builtin_setjmp and __builtin_longjmp?<br>
> I don't get the correct result when I compile and run the following code with clang.<br>
><br>
> # clang foo.c -O3; ./a.out<br>
><br>
> #include <stdio.h><br>
> void *buf[20];<br>
> void __attribute__((noinline))<br>
> foo (void)<br>
> {<br>
>   __builtin_longjmp (buf, 1);<br>
> }<br>
><br>
> int<br>
> main (int argc, char** argv)<br>
> {<br>
>   if (__builtin_setjmp (buf))<br>
>     {<br>
>       printf("return\n");<br>
>       return 0;<br>
>     }<br>
><br>
>   printf("call foo\n");<br>
>     foo ();<br>
><br>
>   return 1;<br>
> }<br>
><br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
</blockquote></div><br>