[llvm-bugs] [Bug 40198] New: regression: assertion triggered in DwarfUnit

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 1 21:15:11 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40198

            Bug ID: 40198
           Summary: regression: assertion triggered in DwarfUnit
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at ziglang.org
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Created attachment 21282
  --> https://bugs.llvm.org/attachment.cgi?id=21282&action=edit
test.ll

This is a regression in trunk from LLVM 7.0.0. The Zig Standard Library tests
in --release-safe mode trigger an assertion in LLVM trunk, but not in LLVM
7.0.0.

Trunk commit:

commit 99cd11ca6529d6b0f3ef38bc4933c78158334771 (HEAD -> master, origin/master,
origin/HEAD)
Author: Robert Widmann <devteam.codafi at gmail.com>
Date:   Tue Jan 1 19:03:37 2019 +0000

    [LLVM-C] bool -> LLVMBool



Backtrace, with some debug info printed:

#31 0x0000000001d9cc8b in ZigLLVMTargetMachineEmitToFile
(targ_machine_ref=0xaa049e0, module_ref=0xaa01f70, filename=0x4616c3c0
"zig-cache/test.o", output_type=ZigLLVM_EmitBinary,
error_message=0x7fffffffb2a8, 
    is_debug=false, is_small=false, time_report=false) at
/store/dev/zig/src/zig_llvm.cpp:193
193         MPM.run(*module);
(gdb) 
#30 0x0000000005ee7bed in llvm::legacy::PassManager::run (this=0x7fffffffafc0,
M=...) at /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1888
1888      return PM->run(M);
(gdb) 
#29 0x0000000005ee79be in llvm::legacy::PassManagerImpl::run (this=0x3b4bf250,
M=...) at /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1857
1857        Changed |= getContainedManager(Index)->runOnModule(M);
(gdb) 
#28 0x0000000005ee7226 in (anonymous namespace)::MPPassManager::runOnModule
(this=0xefd97a0, M=...) at
/store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1744
1744          LocalChanged |= MP->runOnModule(M);
(gdb) 
#27 0x0000000005ee6e7a in llvm::FPPassManager::runOnModule (this=0x4662bbe0,
M=...) at /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1679
1679        Changed |= runOnFunction(F);
(gdb) 
#26 0x0000000005ee6c56 in llvm::FPPassManager::runOnFunction (this=0x4662bbe0,
F=...) at /store/dev/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1644
1644          LocalChanged |= FP->runOnFunction(F);
(gdb) 
#25 0x0000000004b5dca2 in llvm::MachineFunctionPass::runOnFunction
(this=0xbaab500, F=...) at
/store/dev/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:74
74        bool RV = runOnMachineFunction(MF);
(gdb) 
#24 0x00000000043557d3 in llvm::X86AsmPrinter::runOnMachineFunction
(this=0xbaab500, MF=...) at
/store/dev/llvm-project/llvm/lib/Target/X86/X86AsmPrinter.cpp:78
78        EmitFunctionBody();
(gdb) 
#23 0x0000000004929fa3 in llvm::AsmPrinter::EmitFunctionBody (this=0xbaab500)
at /store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1230
1230        HI.Handler->endFunction(MF);
(gdb) 
#22 0x0000000004946e97 in llvm::DebugHandlerBase::endFunction (this=0x4c9d2860,
MF=0x4efc9380) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp:319
319         endFunctionImpl(MF);
(gdb) p MF->dump()
# Machine code for function init_vdso_clock_gettime: NoPHIs, TracksLiveness,
NoVRegs

bb.0.Then:
  DBG_VALUE $edi, $noreg, !"clk", !DIExpression(), debug-location !3639;
index.zig:968:35 line no:968
  DBG_VALUE $rsi, $noreg, !"ts", !DIExpression(), debug-location !3640;
index.zig:968:45 line no:968
  DBG_VALUE 0, $noreg, !"addr", !DIExpression(), debug-location !3641;
index.zig:969:5 line no:969
  DBG_VALUE 0, $noreg, !"f", !DIExpression(), debug-location !3642;
index.zig:970:5 line no:970
  renamable $rax = LEA64r $rip, 1, $noreg, @init_vdso_clock_gettime, $noreg,
debug-location !3643; index.zig:971:9
  renamable $ecx = XOR32rr undef $ecx(tied-def 0), undef $ecx, implicit-def
dead $eflags, implicit-def $rcx
  LCMPXCHG64 $rip, 1, $noreg, @vdso_clock_gettime, $noreg, killed renamable
$rcx, implicit-def dead $rax, implicit-def dead $eflags, implicit $rax,
debug-location !3643 :: (volatile load store monotonic monotonic 8 on `i64*
bitcast (i64 (i32, %timespec.41*)** @vdso_clock_gettime to i64*)`);
index.zig:971:9
  $rax = MOV64ri32 -38, debug-location !3645; index.zig:972:28
  RETQ $rax, debug-location !3645; index.zig:972:28

# End machine code for function init_vdso_clock_gettime.

$2 = void
(gdb) up
#21 0x0000000004958f84 in llvm::DwarfDebug::endFunctionImpl (this=0x4c9d2860,
MF=0x4efc9380) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1615
1615      DIE &ScopeDIE = TheCU.constructSubprogramScopeDIE(SP, FnScope);
(gdb) 
#20 0x0000000004a1c3b5 in llvm::DwarfCompileUnit::constructSubprogramScopeDIE
(this=0xaa07fd0, Sub=0x4ac18250, Scope=0x4e889b10) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:751
751         if (DIE *ObjectPointer = createAndAddScopeChildren(Scope,
ScopeDIE))
(gdb) 
#19 0x0000000004a1c4da in llvm::DwarfCompileUnit::createAndAddScopeChildren
(this=0xaa07fd0, Scope=0x4e889b10, ScopeDIE=...) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:773
773       DIE *ObjectPointer = createScopeChildrenDIE(Scope, Children);
(gdb) 
#18 0x0000000004a1c2cd in llvm::DwarfCompileUnit::createScopeChildrenDIE
(this=0xaa07fd0, Scope=0x4e889b10, Children=..., HasNonScopeChildren=0x0)
    at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:736
736         constructScopeDIE(LS, Children);
(gdb) 
#17 0x0000000004a1a4d8 in llvm::DwarfCompileUnit::constructScopeDIE
(this=0xaa07fd0, Scope=0x4eafc440, FinalChildren=...) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:396
396         createScopeChildrenDIE(Scope, Children, &HasNonScopeChildren);
(gdb) 
#16 0x0000000004a1c2cd in llvm::DwarfCompileUnit::createScopeChildrenDIE
(this=0xaa07fd0, Scope=0x4eafc440, Children=...,
HasNonScopeChildren=0x7fffffff9e17)
    at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:736
736         constructScopeDIE(LS, Children);
(gdb) 
#15 0x0000000004a1a4d8 in llvm::DwarfCompileUnit::constructScopeDIE
(this=0xaa07fd0, Scope=0x4e889c50, FinalChildren=...) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:396
396         createScopeChildrenDIE(Scope, Children, &HasNonScopeChildren);
(gdb) 
#14 0x0000000004a1c2cd in llvm::DwarfCompileUnit::createScopeChildrenDIE
(this=0xaa07fd0, Scope=0x4e889c50, Children=...,
HasNonScopeChildren=0x7fffffff9a87)
    at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:736
736         constructScopeDIE(LS, Children);
(gdb) 
#13 0x0000000004a1a4d8 in llvm::DwarfCompileUnit::constructScopeDIE
(this=0xaa07fd0, Scope=0x4e889d20, FinalChildren=...) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:396
396         createScopeChildrenDIE(Scope, Children, &HasNonScopeChildren);
(gdb) 
#12 0x0000000004a1c2cd in llvm::DwarfCompileUnit::createScopeChildrenDIE
(this=0xaa07fd0, Scope=0x4e889d20, Children=...,
HasNonScopeChildren=0x7fffffff96f7)
    at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:736
736         constructScopeDIE(LS, Children);
(gdb) 
#11 0x0000000004a1a4d8 in llvm::DwarfCompileUnit::constructScopeDIE
(this=0xaa07fd0, Scope=0x4e8896d0, FinalChildren=...) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:396
396         createScopeChildrenDIE(Scope, Children, &HasNonScopeChildren);
(gdb) 
#10 0x0000000004a1bfd4 in llvm::DwarfCompileUnit::createScopeChildrenDIE
(this=0xaa07fd0, Scope=0x4e8896d0, Children=...,
HasNonScopeChildren=0x7fffffff9367)
    at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:719
719         Children.push_back(constructVariableDIE(*DV, *Scope,
ObjectPointer));
(gdb) 
#9  0x0000000004a1b822 in llvm::DwarfCompileUnit::constructVariableDIE
(this=0xaa07fd0, DV=..., Scope=..., ObjectPointer=@0x7fffffff91c8: 0x0)
    at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:624
624       auto Var = constructVariableDIE(DV, Scope.isAbstractScope());
(gdb) 
#8  0x0000000004a1aed6 in llvm::DwarfCompileUnit::constructVariableDIE
(this=0xaa07fd0, DV=..., Abstract=false) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:522
522       auto D = constructVariableDIEImpl(DV, Abstract);
(gdb) 
#7  0x0000000004a1b3bb in llvm::DwarfCompileUnit::constructVariableDIEImpl
(this=0xaa07fd0, DV=..., Abstract=false) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:581
581             addConstantValue(*VariableDie, DVInsn->getOperand(0),
DV.getType());
(gdb) 
#6  0x00000000049a2ff2 in llvm::DwarfUnit::addConstantValue (this=0xaa07fd0,
Die=..., MO=..., Ty=0x2a6407a0) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:523
523       addConstantValue(Die, isUnsignedDIType(DD, Ty), MO.getImm());
(gdb) 
#5  0x00000000049a2bac in isUnsignedDIType (DD=0x4c9d2860, Ty=0x2a6407a0) at
/store/dev/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:470
470       auto *BTy = cast<DIBasicType>(Ty);
(gdb) 
#4  0x0000000003ad97b2 in llvm::cast<llvm::DIBasicType, llvm::DIType const>
(Val=0x2a6407a0) at
/store/dev/llvm-project/llvm/include/llvm/Support/Casting.h:255
255       assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
(gdb) ptype X
type = class llvm::DIBasicType : public llvm::DIType {
  private:
    unsigned int Encoding;

    DIBasicType(llvm::LLVMContext &, llvm::Metadata::StorageType, unsigned int,
uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags,
llvm::ArrayRef<llvm::Metadata*>);
    ~DIBasicType();
    static llvm::DIBasicType * getImpl(llvm::LLVMContext &, unsigned int,
llvm::StringRef, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags,
llvm::Metadata::StorageType, bool);
    static llvm::DIBasicType * getImpl(llvm::LLVMContext &, unsigned int,
llvm::MDString *, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags,
llvm::Metadata::StorageType, bool);
    llvm::TempDIBasicType cloneImpl(void) const;
  public:
    static llvm::DIBasicType * get(llvm::LLVMContext &, unsigned int,
llvm::StringRef);
    static llvm::DIBasicType * get(llvm::LLVMContext &, unsigned int,
llvm::StringRef, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::DIBasicType * get(llvm::LLVMContext &, unsigned int,
llvm::MDString *, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::DIBasicType * getIfExists(llvm::LLVMContext &, unsigned int,
llvm::StringRef);
    static llvm::DIBasicType * getIfExists(llvm::LLVMContext &, unsigned int,
llvm::StringRef, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::DIBasicType * getIfExists(llvm::LLVMContext &, unsigned int,
llvm::MDString *, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::DIBasicType * getDistinct(llvm::LLVMContext &, unsigned int,
llvm::StringRef);
    static llvm::DIBasicType * getDistinct(llvm::LLVMContext &, unsigned int,
llvm::StringRef, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::DIBasicType * getDistinct(llvm::LLVMContext &, unsigned int,
llvm::MDString *, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::TempDIBasicType getTemporary(llvm::LLVMContext &, unsigned
int, llvm::StringRef);
    static llvm::TempDIBasicType getTemporary(llvm::LLVMContext &, unsigned
int, llvm::StringRef, uint64_t, uint32_t, unsigned int, llvm::DINode::DIFlags);
    static llvm::TempDIBasicType getTemporary(llvm::LLVMContext &, unsigned
int, llvm::MDString *, uint64_t, uint32_t, unsigned int,
llvm::DINode::DIFlags);
    llvm::TempDIBasicType clone(void) const;
    unsigned int getEncoding(void) const;
    llvm::Optional<llvm::DIBasicType::Signedness> getSignedness(void) const;
    static bool classof(const llvm::Metadata *);
}
(gdb) 

Source code:

var vdso_clock_gettime = init_vdso_clock_gettime;
extern fn init_vdso_clock_gettime(clk: i32, ts: *timespec) usize {
    const addr = vdso.lookup(VDSO_CGT_VER, VDSO_CGT_SYM);
    var f = @intToPtr(@typeOf(init_vdso_clock_gettime), addr);
    _ = @cmpxchgStrong(@typeOf(init_vdso_clock_gettime), &vdso_clock_gettime,
init_vdso_clock_gettime, f, builtin.AtomicOrder.Monotonic,
builtin.AtomicOrder.Monotonic);
    if (@ptrToInt(f) == 0) return @bitCast(usize, isize(-ENOSYS));
    return f(clk, ts);
}

Module LLVM IR attached. You can use `clang -c test.ll -O3` to reproduce the
assertion.

-- 
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/20190102/8bd77800/attachment-0001.html>


More information about the llvm-bugs mailing list