[LLVMdev] built-in longjmp and setjmp

Akira Hatanaka ahatanak at gmail.com
Tue Apr 12 13:56:36 PDT 2011


Does the X86 backend (or any other backend) correctly implement support for
__builtin_setjmp and __builtin_longjmp?
I don't get the correct result when I compile and run the following code
with clang.

# clang foo.c -O3; ./a.out

#include <stdio.h>
void *buf[20];
void __attribute__((noinline))
foo (void)
{
  __builtin_longjmp (buf, 1);
}

int
main (int argc, char** argv)
{
  if (__builtin_setjmp (buf))
    {
      printf("return\n");
      return 0;
    }

  printf("call foo\n");
    foo ();

  return 1;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110412/f99a0f29/attachment.html>


More information about the llvm-dev mailing list