[LLVMbugs] [Bug 4605] New: ParseBitcodeFile() no longer works on files with @llvm. global_ctors

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jul 22 07:27:26 PDT 2009


           Summary: ParseBitcodeFile() no longer works on files with
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: major
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: csdavec at swan.ac.uk
                CC: llvmbugs at cs.uiuc.edu

This simple program now crashes (tested with r76735):

#include <llvm/Bitcode/ReaderWriter.h>
#include <llvm/Support/MemoryBuffer.h>
#include <llvm/LLVMContext.h>

int main(int argc, char *argv[])
            *new llvm::LLVMContext());

The bug appears to have been introduced as part of the process of adding
LLVMContext.  Other appending globals appear to work correctly, but any bitcode
file containing @llvm.global_ctors crashes with this assert failure:

Assertion failed: (IMI != InverseMap.end() && IMI->second != Map.end() &&
IMI->second->second == CP && "InverseMap corrupt!"), function
FindExistingElement, file LLVMContextImpl.cpp, line 141.

Back trace as follows:

#0  0x283e2e87 in kill () from /lib/libc.so.7
#1  0x281d6347 in raise () from /lib/libthr.so.3
#2  0x283e19ea in abort () from /lib/libc.so.7
#3  0x283c7eb6 in __assert () from /lib/libc.so.7
#4  0x080f5a6b in ValueMap<std::vector<llvm::Constant*,
std::allocator<llvm::Constant*> >, llvm::ArrayType, llvm::ConstantArray,
true>::FindExistingElement (
    this=0x285170a0, CP=0x2855904c) at LLVMContextImpl.cpp:139
#5  0x080f60ba in ValueMap<std::vector<llvm::Constant*,
std::allocator<llvm::Constant*> >, llvm::ArrayType, llvm::ConstantArray,
true>::remove (
    this=0x285170a0, CP=0x2855904c) at LLVMContextImpl.cpp:208
#6  0x080f490b in llvm::LLVMContextImpl::erase (this=0x28509080, C=0x2855904c)
    at LLVMContextImpl.cpp:476
#7  0x080f0a46 in llvm::LLVMContext::erase (this=0x2850808c, C=0x2855904c)
    at LLVMContext.cpp:658
#8  0x080a47f6 in llvm::ConstantArray::destroyConstant (this=0x2855904c)
    at Constants.cpp:1041
#9  0x080522e3 in llvm::BitcodeReaderValueList::ResolveConstantForwardRefs (
    this=0x2851f270) at BitcodeReader.cpp:305
#10 0x08054ab6 in llvm::BitcodeReader::ParseConstants (this=0x2851f180)
    at BitcodeReader.cpp:1070
#11 0x08059130 in llvm::BitcodeReader::ParseModule (this=0x2851f180, 
    ModuleID=@0xbfbfe5f0) at BitcodeReader.cpp:1171
#12 0x0805a700 in llvm::BitcodeReader::ParseBitcode (this=0x2851f180)
    at BitcodeReader.cpp:1406
#13 0x0805a7c5 in llvm::getBitcodeModuleProvider (Buffer=0x2851c020, 
    Context=@0x2850809c, ErrMsg=0x0) at BitcodeReader.cpp:2104
#14 0x0805a85b in llvm::ParseBitcodeFile (Buffer=0x2851c020, 
    Context=@0x2850809c, ErrMsg=0x0) at BitcodeReader.cpp:2122
#15 0x0804f10d in main (argc=2, argv=0xbfbfe6e8) at ParseBitcode.cpp:10

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