[LLVMbugs] [Bug 9015] New: module linking crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 20 19:36:03 PST 2011


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

           Summary: module linking crash
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Linker
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: dpatel at apple.com, llvmbugs at cs.uiuc.edu


Created an attachment (id=6030)
 --> (http://llvm.org/bugs/attachment.cgi?id=6030)
testcase

$ llvm-ld -link-as-library -disable-opt gdevmem.bc -o linked.rbc


Program received signal SIGSEGV, Segmentation fault.
0x00000000007eaf6e in llvm::PATypeHolder::get (this=Cannot access memory at
address 0x7fffff5feff8
)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/Type.h:506
506     inline Type* PATypeHolder::get() const {
(gdb) bt
#0  0x00000000007eaf6e in llvm::PATypeHolder::get (this=Cannot access memory at
address 0x7fffff5feff8
)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/Type.h:506
#1  0x000000000080db7e in llvm::PATypeHolder::operator-> (this=0x11c13b0)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/AbstractTypeUser.h:163
#2  0x0000000000c16ab2 in llvm::Value::getContext (this=0x11c13a0)
    at Value.cpp:434
#3  0x0000000000c16c5f in llvm::ValueHandleBase::AddToUseList (
    this=0x7fffff5ff1b8) at Value.cpp:469

#4  0x000000000080e6b9 in llvm::ValueHandleBase::ValueHandleBase (
    this=0x7fffff5ff1b8, Kind=llvm::ValueHandleBase::Callback, V=0x11c13a0)
    at
/usr/local/google/home/nlewycky/llvm/include/llvm/Support/ValueHandle.h:65
#5  0x000000000080e960 in llvm::CallbackVH::CallbackVH (this=0x7fffff5ff1b0, 
    P=0x11c13a0)
    at
/usr/local/google/home/nlewycky/llvm/include/llvm/Support/ValueHandle.h:369
#6  0x000000000081254f in llvm::ValueMapCallbackVH<llvm::Value const*,
llvm::TrackingVH<llvm::Value>, llvm::ValueMapConfig<llvm::Value const*>,
llvm::DenseMapInfo<llvm::TrackingVH<llvm::Value> > >::ValueMapCallbackVH
(this=0x7fffff5ff1b0, 
    Key=0x11c13a0, Map=0x7fffffffde10)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/ADT/ValueMap.h:204
#7  0x0000000000810dea in llvm::ValueMap<llvm::Value const*,
llvm::TrackingVH<llvm::Value>, llvm::ValueMapConfig<llvm::Value const*>,
llvm::DenseMapInfo<llvm::TrackingVH<llvm::Value> > >::Wrap
(this=0x7fffffffde10, key=0x11c13a0)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/ADT/ValueMap.h:187
#8  0x000000000080f8bf in llvm::ValueMap<llvm::Value const*,
llvm::TrackingVH<llvm::Value>, llvm::ValueMapConfig<llvm::Value const*>,
llvm::DenseMapInfo<llvm::TrackingVH<llvm::Value> > >::find
(this=0x7fffffffde10, Val=@0x7fffff5ff238)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/ADT/ValueMap.h:120
#9  0x00000000009fac8a in llvm::MapValue (V=0x11c13a0, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:25
#10 0x00000000009faee1 in llvm::MapValue (V=0x11e3ad0, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#11 0x00000000009faee1 in llvm::MapValue (V=0x11e0120, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#12 0x00000000009faee1 in llvm::MapValue (V=0x11e3880, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#13 0x00000000009faee1 in llvm::MapValue (V=0x11e36b0, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#14 0x00000000009faee1 in llvm::MapValue (V=0x11e05a0, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#15 0x00000000009faee1 in llvm::MapValue (V=0x11e02f0, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#16 0x00000000009faee1 in llvm::MapValue (V=0x11dfb50, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44

  [...]

#26207 0x00000000009faee1 in llvm::MapValue (V=0x11dea70, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
#26208 0x00000000009fafbc in llvm::MapValue (V=0x11d9d50, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:54
#26209 0x00000000009fb5ef in llvm::RemapInstruction (I=0x1224e00, VMap=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:117
#26210 0x000000000080c4f1 in LinkFunctionBody (Dest=0x11b76c0, Src=0x11c02f0, 
    ValueMap=..., Err=0x7fffffffe250) at LinkModules.cpp:1007
#26211 0x000000000080c6a8 in LinkFunctionBodies (Dest=0x11b6150, 
    Src=0x11b63d0, ValueMap=..., Err=0x7fffffffe250) at LinkModules.cpp:1034
#26212 0x000000000080d950 in llvm::Linker::LinkModules (Dest=0x11b6150, 
    Src=0x11b63d0, ErrorMsg=0x7fffffffe250) at LinkModules.cpp:1277
#26213 0x000000000080784d in llvm::Linker::LinkInModule (this=0x7fffffffe220, 
    Src=0x11b63d0, ErrorMsg=0x7fffffffe250)
    at /usr/local/google/home/nlewycky/llvm/include/llvm/Linker.h:248
#26214 0x00000000008075d7 in llvm::Linker::LinkInFile (this=0x7fffffffe220, 
    File=..., is_native=@0x7fffffffe1bf) at LinkItems.cpp:202
#26215 0x00000000008077ea in llvm::Linker::LinkInFiles (this=0x7fffffffe220, 
    Files=std::vector of length 1, capacity 1 = {...}) at LinkItems.cpp:238
#26216 0x00000000007d9f83 in main (argc=6, argv=0x7fffffffe758, 
    envp=0x7fffffffe790) at llvm-ld.cpp:582

(gdb) up 100
#100 0x00000000009faee1 in llvm::MapValue (V=0x11dfb30, VM=..., 
    Flags=llvm::RF_IgnoreMissingEntries) at ValueMapper.cpp:44
44            if (OP == 0 || MapValue(OP, VM, Flags) == OP) continue;
(gdb) p V
$1 = (const llvm::Value *) 0x11dfb30
(gdb) p V->dump()
Cannot access memory at address 0x7fffff5fef58
(gdb) p OP
$2 = (llvm::Value *) 0x11e01f0
(gdb) p OP->dump()
Cannot access memory at address 0x7fffff5fef58
(gdb) p i
$3 = 10
(gdb) list
39            return VM[V] = const_cast<Value*>(V);
40          
41          // Check all operands to see if any need to be remapped.
42          for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) {
43            Value *OP = MD->getOperand(i);
44            if (OP == 0 || MapValue(OP, VM, Flags) == OP) continue;
45
46            // Ok, at least one operand needs remapping.  Create a dummy node
in case
47            // we have a metadata cycle.
48            MDNode *Dummy = MDNode::getTemporary(V->getContext(), 0, 0);
(gdb) p MD->dump()
Cannot access memory at address 0x7fffff5fef58

The infinite loop is in the "MapValue(OP, VM, Flags) == OP" expression on line
44.

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