[LLVMbugs] Update on LLVM Bug 575
Chris Lattner
sabre at nondot.org
Wed Jun 8 18:18:21 PDT 2005
On Wed, 8 Jun 2005, John Mellor-Crummey wrote:
> 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.
This code (obviously) should work. The function calls in the main
function should be turned into invoke instructions, allowing the inliner
to do the right thing. My guess is that the lowersetjmp pass is doing
something incorrect.
On the other hand, if this is the only issue that you are hitting:
> After tran forming the bytecode to a c code with llc, I have found the
> longjmps and siglongjmps have been replaced with calls to abort.
Then there is an easy fix. Please pass -enable-correct-eh-support to llc,
and it will do the right thing. This will eventually be the default in
the future, but it currently isn't.
If this is the only issue you're running into, please close PR575.
Otherwise, I will definitely look into this when I can. I'm currently out
of town though so it may be a week or two.
Thanks,
-Chris
>>
>> 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 tran forming 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!
>
> _______________________________________________
> LLVMbugs mailing list
> LLVMbugs at cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmbugs
>
-Chris
--
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/
More information about the llvm-bugs
mailing list