[LLVMbugs] [Bug 21197] New: lli crashes with va_arg when using -force-interpreter=true

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 7 16:23:54 PDT 2014


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

            Bug ID: 21197
           Summary: lli crashes with va_arg when using
                    -force-interpreter=true
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: willem_llvm_bugs at lekkertech.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13164
  --> http://llvm.org/bugs/attachment.cgi?id=13164&action=edit
Simple vaarg example.

When compiling the attached example to bitcode and running it with lli
-force-interpreter=true lli crashes. Compiling and running it natively yields
the correct output and running it through lli without -force-interpreter=true
also yields the expected output.



>From running the example with lli -debug and cross checking with the llvm ir,
it seems that the va_start implementation used by the interpreter does not
initialize the __va_list_tag structure correctly, but I do not know what the
correct initialization would look like. (And the crash might have a different
cause al to gether).


users-Mac:test user$clang -O0 -emit-llvm -S vaarg.c
vaarg.c:12:2: warning: implicit declaration of function 'putchar' is invalid in
C99 [-Wimplicit-function-declaration]
        putchar('0' + *i);
        ^
1 warning generated.
users-Mac:test user$ /usr/local/Cellar/llvm/3.5.0/bin/lli --version
LLVM (http://llvm.org/):
  LLVM version 3.5.0
  Optimized build with assertions.
  Built Sep 21 2014 (23:54:15).
  Default target: x86_64-apple-darwin13.4.0
  Host CPU: core-avx-i
users-Mac:test user$ /usr/local/Cellar/llvm/3.5.0/bin/lli
-force-interpreter=false ./vaarg.ll 
2
users-Mac:test user$ /usr/local/Cellar/llvm/3.5.0/bin/lli
-force-interpreter=true ./vaarg.ll 
0  libLLVM-3.5.dylib        0x0000000106cb4bb9
llvm::sys::PrintStackTrace(__sFILE*) + 40
1  libLLVM-3.5.dylib        0x0000000106cb4fa4 SignalHandler(int) + 248
2  libsystem_platform.dylib 0x00007fff94e045aa _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1797241456
4  libLLVM-3.5.dylib        0x000000010699d66e
llvm::Interpreter::visitLoadInst(llvm::LoadInst&) + 156
5  libLLVM-3.5.dylib        0x00000001069a640c llvm::Interpreter::run() + 156
6  libLLVM-3.5.dylib        0x00000001069a9f04
llvm::Interpreter::runFunction(llvm::Function*,
std::__1::vector<llvm::GenericValue, std::__1::allocator<llvm::GenericValue> >
const&) + 240
7  libLLVM-3.5.dylib        0x00000001068f1c81
llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char
const* const*) + 1521
8  lli                      0x000000010651c703
9  libdyld.dylib            0x00007fff8fa3c5fd start + 1
Stack dump:
0.    Program arguments: /usr/local/Cellar/llvm/3.5.0/bin/lli
-force-interpreter=true ./vaarg.ll 
Segmentation fault: 11

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141007/1b26a53a/attachment.html>


More information about the llvm-bugs mailing list