Skip to content

JIT compiler crashes on bitcode from clang #11115

@llvmbot

Description

@llvmbot
Bugzilla Link 10743
Version trunk
OS All
Attachments shell script with c++ code that shows how to trigger the bug
Reporter LLVM Bugzilla Contributor

Extended Description

I have discovered a case where the JIT compiler (ExecutionEnginge::getPointerToFunction(Function*)) aborts with

program: /home/larsr/src/llvm/lib/ExecutionEngine/JIT/JIT.cpp:616: void llvm::JIT::runJITOnFunctionUnlocked(llvm::Function*, const llvm::MutexGuard&): Assertion `!isAlreadyCodeGenerating && "Error: Recursive compilation detected!"' failed.

Here is example code that breaks the JIT when asking it to get the function "makeit":

#include

class C {
public:
C(void);
};

C::C(void) {
std::cout << "CCC\n";
}

extern "C" {
void makeit() { C(); }
}

It crashes when:

  1. I have compiled a C++ class into bitcode with clang, and
  2. the constructor is declared OUTSIDE the type definition, and
  3. I compile WITHOUT optimization.

I have attached a script that compiles and runs the code and crashes when the above criteria are met. (Look at it at pastebin http://pastebin.com/rLHpyprY )

I use
clang version 3.0 (http://llvm.org/git/clang.git ec5bc81fd55bfcc26fc4bde6d5e33113d94c2209)
Target: i386-pc-linux-gnu

and

Low Level Virtual Machine (http://llvm.org/):
llvm version 3.0svn
commit 3c0e5dc
Date: Mon Aug 22 10:32:09 2011 +0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions