[LLVMbugs] [Bug 5042] New: 'Invoke' llvm instruction does not function per documentation

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Sep 24 12:37:59 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5042

           Summary: 'Invoke' llvm instruction does not function per
                    documentation
           Product: libraries
           Version: trunk
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: missing-feature
          Severity: normal
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: zrega at theophad.tmbx.com
                CC: llvmbugs at cs.uiuc.edu


The invoke / unwind functionality does not work as per the documentation.  It
is now my understanding that exception handling in C, C++ is implemented using
other libraries.  Currently (in svn) when a unwind instruction is encountered,
the program unwinds (Good), but the invoke does not handle it.  The following
code will throw a segmentation fault on my system.

My system:
triple=powerpc-unknown-linux-gnu
llvm from svn 9/23/2009

Proposed resolution:
 * Change Documentation if this will not be supported without other libraries
 * Change llvm to adhear to the docs.  Which could be hard to do.


To Reproduce:

Run the following code through llvm-as then lli or llc.

//====---- Code Start -----========//
@.str = internal constant [6 x i8] c"Hello\00"          ; <[6 x i8]*> [#uses=1]
@.strFunctionError = internal constant [36 x i8] c"Could not call function!
Exiting...\00"              ; <[36 x i8]*> [#uses=1]

define i32 @main() nounwind {
entry:
        %0 = tail call i32 @puts(i8* getelementptr ([6 x i8]* @.str, i32 0, i32
0)) nounwind            ; <i32> [#uses=0]
        %a = invoke i32 @functionToFail() to label %normal unwind label
%exception

exception:
        tail call i32 @puts(i8* getelementptr ([36 x i8]* @.strFunctionError,
i32 0, i32 0)) nounwind
        ret i32 -1      
normal:
        %.fo = tail call i32 @puts(i8* getelementptr ([6 x i8]* @.str, i32 0,
i32 0)) nounwind  
        ret i32 0
}

define i32 @functionToFail()
{
entry:
        unwind
        ret i32 0
}

declare i32 @puts(i8*)
//====---- Code End -----========//


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list