[LLVMbugs] Update on LLVM Bug 575

John Mellor-Crummey johnmc at cs.rice.edu
Wed Jun 8 16:20:21 PDT 2005


A few comments about bug 575.

First, in the example below, the optimizer inlines both foo and bar. 
When an 'unwind' instruction from bar executes, nothing good can 
happen. It seems to me that one can't just inline functions with 
unwind instructions in them, if I understand the LLVM assembly manual 
semantics. They say that when an unwind occurs, the function stops 
dead. Thus, if an unwind is inlined into main from bar by way of foo, 
bar can't use unwind to transfer control to somewhere else in main to 
continue execution.

When disable-inlining is specified, there is still a problem. The 
exception processing does not properly transfer control for the 
longjmp. This is true even when compiled with 
-enable-correct-eh-support.

John


>
>Date: Wed, 8 Jun 2005 11:42:30 -0500
>From: bugzilla-daemon at cs.uiuc.edu
>Subject: [LLVMbugs] [Bug 575] NEW: longjmp and siglongjmp are
>	transformed	into aborts
>To: llvmbugs at cs.uiuc.edu
>Message-ID: <200506081642.LAA32552 at zion.cs.uiuc.edu>
>
>http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=575
>
>            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
>
>
>Hi,
>
>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");
>     exit(0);
>   }
>
>   s = setjmp(env);
>   if (s != 0) {
>     printf("Error: value of i or j is zero\n");
>     exit(0);
>   }
>
>   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.
>
>
>
>------------------------------
>
>_______________________________________________
>LLVMbugs mailing list
>LLVMbugs at cs.uiuc.edu
>http://mail.cs.uiuc.edu/mailman/listinfo/llvmbugs
>
>
>End of LLVMbugs Digest, Vol 12, Issue 3
>***************************************
>
>!DSPAM:42a72c9811011524727571!




More information about the llvm-bugs mailing list