[LLVMbugs] [Bug 575] NEW: longjmp and siglongjmp are transformed into aborts

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jun 8 09:42:30 PDT 2005


           Summary: longjmp and siglongjmp are transformed into aborts
           Product: libraries
           Version: 1.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Transformation Utilities
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jin at cs.rice.edu


I had the longjmp and siglongjmp problems when I compiled a set of R library functions
where some of them use setjmp/longjmp and sigsetjmp/siglongjmp. I had abort when
I run the executable generated from llvm. After tranforming the bytecode to a c code
with llc, I have found the longjmps and siglongjmps have been replaced with calls to abort.

Here is a short example:

#include <setjmp.h>
#include <stdio.h>

int bar(jmp_buf env, int i)
  if (i == 0) longjmp(env, 1);
  return i;

int foo(jmp_buf env, int i, int j)
  return bar(env, i) + bar(env, j);

main(int argc, char **argv)
  jmp_buf env;
  int i, j, v, s;

  if (argc != 3) {
    printf("Usage: a.out i j\n");

  s = setjmp(env);
  if (s != 0) {
    printf("Error: value of i or j is zero\n");

  i = atoi(argv[1]);
  j = atoi(argv[2]);

  v = foo(env, i, j);
  printf("Correct: sum = %d\n", v);

Compiling this code with gcc would work fine. Thank you very much for your help!
Guohua Jin

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list