[LLVMbugs] [Bug 4560] New: "Recursive compilation detected" and Linux signals

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jul 15 09:23:12 PDT 2009


           Summary: "Recursive compilation detected" and Linux signals
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: mattp223 at renzelmann.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=3199)
 --> (http://llvm.org/bugs/attachment.cgi?id=3199)
C program that should crash lli utility with "Recursive compilation detected"

I reported this to the llvmdev mailing list yesterday because bugzilla was not
responding for some reason, but everything appears fine today, so I thought I'd
post here so it'd be more accessible.

Platform is RHEL5, GCC 4.2.4, x86-32, and LLVM/LLVM-GCC from subversion
(two days ago).  I'm compiling C code into bitcode, and then executing
the bitcode using the JIT compiler (lli).

I've managed to reproduce a problem when multiple signals go off around the
same time.  A small sample program is attached.  The result is the "recursive
compilation detected" JIT compiler error.  The same program compiled via GCC
works fine.  Note that the sample program uses the preprocessor to create
large amounts of superfluous code to tie-up the JIT compiler.

Compile the attachment with:
llvm-gcc -c -emit-llvm ./main.c -o main.bc

And run it with:
lli main.bc

Here's the output from the debug version of the lli utility.  Note that I
slightly tweaked my version of LLVM to print out the function that it's
attempting to JIT, and the function that it was previously JIT'ing when it
detected the recursion.  This print statement makes it clear that the JIT
compiler was working on sigsegv_handler before it attempted to start on
Recursive compilation:
Function: timer_handler, existing function sigsegv_handler
lli: JIT.cpp:579: void llvm::JIT::runJITOnFunctionUnlocked(llvm::Function*,
const llvm::MutexGuard&): Assertion `!isAlreadyCodeGenerating && "Error:
Recursive compilation detected!"' failed.
0   lli       0x08a5308e
1   lli       0x08a53601
2             0x008e0420 __kernel_sigreturn + 0
3   libc.so.6 0x00146ac1 abort + 257
4   libc.so.6 0x0013e39e __assert_fail + 238
5   lli       0x08738aa4
llvm::JIT::runJITOnFunctionUnlocked(llvm::Function*, llvm::MutexGuard
const&) + 408
6   lli       0x08738f6d llvm::JIT::getPointerToFunction(llvm::Function*) +
7   lli       0x0873f704
8   lli       0x08597416 X86CompilationCallback2 + 166
9   lli       0x08596e08 X86CompilationCallback + 24
10  lli       0x00eebff5 X86CompilationCallback + 4170535429
11  lli       0x0863e13e llvm::CallSDNode::CallSDNode(unsigned int,
llvm::DebugLoc, bool, bool, bool, llvm::SDVTList, llvm::SDValue const*,
unsigned int, unsigned int) + 90
12  lli       0x08622d47 llvm::SelectionDAG::getCall(unsigned int,
llvm::DebugLoc, bool, bool, bool, llvm::SDVTList, llvm::SDValue const*,
unsigned int, unsigned int) + 419
13  lli       0x08648853 llvm::TargetLowering::LowerCallTo(llvm::SDValue,
llvm::Type const*, bool, bool, bool, bool, unsigned int, unsigned int, bool,
llvm::SDValue, std::vector<llvm::TargetLowering::ArgListEntry,
std::allocator<llvm::TargetLowering::ArgListEntry> >&, llvm::SelectionDAG&,
llvm::DebugLoc) + 2125
14  lli       0x0864f8c6
llvm::SelectionDAGLowering::LowerCallTo(llvm::CallSite, llvm::SDValue, bool,
llvm::MachineBasicBlock*) + 1418
15  lli       0x0865c6b1
llvm::SelectionDAGLowering::visitCall(llvm::CallInst&) + 2527
16  lli       0x08666d1e llvm::SelectionDAGLowering::visit(unsigned int,
llvm::User&) + 1108
17  lli       0x08666e16
llvm::SelectionDAGLowering::visit(llvm::Instruction&) + 52
18  lli       0x086824ff
llvm::ilist_iterator<llvm::Instruction>) + 99
19  lli       0x086830fd
llvm::MachineFunction&, llvm::MachineModuleInfo*, llvm::DwarfWriter*,
llvm::TargetInstrInfo const&) + 2433
20  lli       0x08683f20
llvm::SelectionDAGISel::runOnFunction(llvm::Function&) + 908
21  lli       0x089dad71 llvm::FPPassManager::runOnFunction(llvm::Function&)
+ 289
22  lli       0x089db302 llvm::FunctionPassManagerImpl::run(llvm::Function&)
+ 124
23  lli       0x089db4d1 llvm::FunctionPassManager::run(llvm::Function&) +
24  lli       0x08738b09
llvm::JIT::runJITOnFunctionUnlocked(llvm::Function*, llvm::MutexGuard
const&) + 509
25  lli       0x08738f6d llvm::JIT::getPointerToFunction(llvm::Function*) +
26  lli       0x0873f704
27  lli       0x08597416 X86CompilationCallback2 + 166
28  lli       0x08596e08 X86CompilationCallback + 24
29  lli       0x00eebfed X86CompilationCallback + 4170535421
30  lli       0x08759bdd
std::vector<std::string, std::allocator<std::string> > const&, char const*
const*) + 1255
31  lli       0x08390e66 main + 1946
32  libc.so.6 0x001316d0 __libc_start_main + 224
33  lli       0x0838fd61
Stack dump:
0.      Program arguments: /scratch/sym/llvm-current/Debug/bin/lli main.bc 
1.      Running pass 'X86 DAG->DAG Instruction Selection' on function

Please let me know if I'm missing something :)  Is this behavior by design
or is it a bug/limitation?

Thanks and regards,

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