[LLVMbugs] [Bug 3573] New: lli crash -force-interpreter and stdlib function calls

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Feb 13 08:40:44 PST 2009


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

           Summary: lli crash -force-interpreter and stdlib function calls
           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: reynaudd at loria.fr
                CC: llvmbugs at cs.uiuc.edu


The following C program crashes when compiled with -O3 and run with lli
-force-interpreter on my system:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
    int number;
    if(argc<2) {
        printf("Usage: %s <number>\n", argv[0]);
        exit(1);
    }

// other calls such as atof also provoke the crash
    number = atoi(argv[1]);
    printf("hello %d\n", number);
}

Steps to reproduce the crash:

~/test/llvm$ llvm-gcc -emit-llvm -O3 -c hello.c -o hello.bc
~/test/llvm$ lli -force-interpreter hello.bc 42
lli: /tmp/buildd/llvm-2.2/lib/Support/APInt.cpp:109: llvm::APInt::APInt(const
llvm::APInt&): Assertion `BitWidth <= MAX_INT_BITS && "bitwidth too large"'
failed.
lli[0x843d88]
/lib/libc.so.6[0x7f6f3b9daf60]
/lib/libc.so.6(gsignal+0x35)[0x7f6f3b9daed5]
/lib/libc.so.6(abort+0x183)[0x7f6f3b9dc3f3]
/lib/libc.so.6(__assert_fail+0xe9)[0x7f6f3b9d3dc9]
lli(llvm::APInt::APInt(llvm::APInt const&)+0xc3)[0x820773]
lli(llvm::Interpreter::callExternalFunction(llvm::Function*,
std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> >
const&)+0xc7)[0x5be997]
lli(llvm::Interpreter::callFunction(llvm::Function*,
std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> >
const&)+0x55f)[0x5b6adf]
lli(llvm::Interpreter::visitCallSite(llvm::CallSite)+0x22e)[0x5b86ce]
lli(llvm::InstVisitor<llvm::Interpreter,
void>::visit(llvm::Instruction&)+0xa6)[0x5c22b6]
lli(llvm::Interpreter::run()+0x61)[0x5b92a1]
lli(llvm::Interpreter::runFunction(llvm::Function*,
std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> >
const&)+0xbc)[0x5bf35c]
lli(llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > const&, char const*
const*)+0x497)[0x5c89d7]
lli(main+0x21d)[0x4b362d]
/lib/libc.so.6(__libc_start_main+0xe6)[0x7f6f3b9c71a6]
lli(std::ios_base::Init::~Init()+0x41)[0x4b2ec9]
Aborted

The program runs correctly without -force-interpreter, without -emit-llvm and
with -O0.

Configuration info (llvm was obtained with apt-get):

~/test/llvm$ lli --version
Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.2 (Debian 2.2-12)
  Optimized build with assertions.

~/test/llvm$ uname -a
Linux XXX 2.6.26-1-amd64 #1 SMP Sat Jan 10 17:57:00 UTC 2009 x86_64 GNU/Linux


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