[LLVMbugs] [Bug 5439] New: Exceptions crash after calling freeMachineCodeForFunction()

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Nov 9 02:48:50 PST 2009


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

           Summary: Exceptions crash after calling
                    freeMachineCodeForFunction()
           Product: new-bugs
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: oliver at plexim.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3793)
 --> (http://llvm.org/bugs/attachment.cgi?id=3793)
Example application to demonstrate crash

Hi all,

we're facing a problem when enabling exception handling in JIT and calling
ExecutionEngine::freeMachineCodeForFunction(). If an exception is thrown
afterwards anywhere in the application (outside of llvm), the whole application
crashes.

As far as I can see this is due to an exception frame being registered in
JITEmitter::finishFunction() which is not (and currently cannot) be
unregistered when the function is freed again.

I've attached a small test program that demonstrates the problem. It needs to
be compiled with "make REQUIRES_EH=1". If run without arguments (i.e. no
exception handling enabled in JIT), all is fine. If argument "-enable-eh" is
used, the test application crashes once the exception is thrown.

Note: A workaround for this problem seems to be to throw and catch a dummy
exception before instantiating the execution engine. However, in the project
I'm working on the whole llvm code is used in a shared library which may be
loaded and unloaded several times during the runtime of the application. In
this case the workaround fails.

All tests were done on OS X  10.5.8, using llvm trunk rev. 86536 and llvm 2.6.

Kind regards,

Oliver Schwartz


-- 
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