[LLVMbugs] [Bug 720] NEW: Segfault when running hello world with invalid bytecode signature

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Mar 21 16:13:02 PST 2006


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=720

           Summary: Segfault when running hello world with invalid bytecode
                    signature
           Product: tools
           Version: 1.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: lli
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: u3950692 at anu.edu.au


Hi,

I wrote a Hello World program in c++, which compiled without errors on llvm-g++.
 When I run the resulting file, though, I get a segmentation fault.  Attempting
to use llvm-dis tells me about an invalid bytecode signature.  This happened
when using the provided ./hello script, and also when manually invoking lli on
./hello.bc

I am on an x86 system running Gentoo linux, 
llvm-g++ version 
  llvm-g++ (GCC) 3.4-llvm 20051104 (LLVM 1.6)
g++ version 
  g++ (GCC) 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9)

The code
========
#include <iostream>

int main(){
  std::cout<<"Hello World, via LLVM.\n";
  return 0;
}


The command line:
=================
llvm-g++
-I/usr/local/bin/llvm/cfrontend/x86/llvm-gcc/lib/gcc/i686-pc-linux-gnu/3.4-llvm/include/
-I /usr/local/bin/llvm/cfrontend/x86/llvm-gcc/include/c++/3.4-llvm/ -L
/usr/local/bin/llvm/cfrontend/x86/llvm-gcc/lib/ -I
/usr/local/bin/llvm/cfrontend/x86/llvm-gcc/include/c++/3.4-llvm/i686-pc-linux-gnu/
-o hello hello.cpp


The segfault:
=============
lli((anonymous namespace)::PrintStackTrace()+0x1a)[0x85437a8]
lli((anonymous namespace)::SignalHandler(int)+0xe9)[0x8543a37]
[0xffffe420]
[0xb6d363d0]
[0xb6d36032]
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*)+0x2ee)[0x83760f0]
lli(main+0x286)[0x82f03a8]
/lib/libc.so.6(__libc_start_main+0xda)[0xb7cfa09a]
lli(__gxx_personality_v0+0x121)[0x82eff91]
Segmentation fault

llvm-dis output:
================
llvm-dis: Invalid bytecode signature: 622F2123 (Vers=0, Pos=4)



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list