Skip to content

Assertion breaks in llvm when -g is used. #13681

Closed
@farcaller

Description

@farcaller

On recent rust, compiling the code with -g fails with

Assertion failed: (Ty == resolve(Ty.getRef()) && "type was not uniqued, possible ODR violation."), function getOrCreateTypeDIE, file /Users/farcaller/temp/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp, line 984.

Here's the backtrace:

* thread #2: tid = 0x3cc39f, 0x00007fff8bcba866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
  * frame #0: 0x00007fff8bcba866 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff8a9bd35c libsystem_pthread.dylib`pthread_kill + 92
    frame #2: 0x00000001026ff13b librustc-4283bb68-0.11-pre.dylib`raise(sig=6) + 27 at Signals.inc:368
    frame #3: 0x00000001026ff1f2 librustc-4283bb68-0.11-pre.dylib`abort + 18 at Signals.inc:385
    frame #4: 0x00000001026ff1d1 librustc-4283bb68-0.11-pre.dylib`__assert_rtn(func=0x0000000102a4c377, file=0x0000000102a4c1d9, line=984, expr=0x0000000102a4c3b8) + 129 at Signals.inc:381
    frame #5: 0x0000000101ad7dbf librustc-4283bb68-0.11-pre.dylib`llvm::DwarfUnit::getOrCreateTypeDIE(this=0x00000001087b7c20, TyNode=0x000000010650a120) + 303 at DwarfUnit.cpp:983
    frame #6: 0x0000000101adb0b9 librustc-4283bb68-0.11-pre.dylib`llvm::DwarfUnit::addType(this=0x00000001087b7c20, Entity=0x000000010a09a5e0, Ty=DIType at 0x0000000108308618, Attribute=DW_AT_type) + 233 at DwarfUnit.cpp:1053
    frame #7: 0x0000000101ad925d librustc-4283bb68-0.11-pre.dylib`llvm::DwarfUnit::constructTypeDIE(this=0x00000001087b7c20, Buffer=0x000000010a09a5e0, CTy=DICompositeType at 0x0000000108308898) + 461 at DwarfUnit.cpp:1229
    frame #8: 0x0000000101ad806b librustc-4283bb68-0.11-pre.dylib`llvm::DwarfUnit::getOrCreateTypeDIE(this=0x00000001087b7c20, TyNode=0x000000010653fbe0) + 987 at DwarfUnit.cpp:1011
    frame #9: 0x0000000101adb0b9 librustc-4283bb68-0.11-pre.dylib`llvm::DwarfUnit::addType(this=0x00000001087b7c20, Entity=0x000000010a09a4e0, Ty=DIType at 0x00000001083089f8, Attribute=DW_AT_type) + 233 at DwarfUnit.cpp:1053
    frame #10: 0x0000000101ad890e librustc-4283bb68-0.11-pre.dylib`llvm::DwarfUnit::getOrCreateSubprogramDIE(this=0x00000001087b7c20, SP=DISubprogram at 0x0000000108308c40) + 1502 at DwarfUnit.cpp:1507
    frame #11: 0x0000000101a8d258 librustc-4283bb68-0.11-pre.dylib`llvm::DwarfDebug::constructSubprogramDIE(this=0x0000000109804200, TheCU=0x00000001087b7c20, N=0x0000000106459a40) + 152 at DwarfDebug.cpp:767
    frame #12: 0x0000000101a89b48 librustc-4283bb68-0.11-pre.dylib`llvm::DwarfDebug::beginModule(this=0x0000000109804200) + 1400 at DwarfDebug.cpp:852
    frame #13: 0x0000000101a89510 librustc-4283bb68-0.11-pre.dylib`DwarfDebug(this=0x0000000109804200, A=0x00000001087d8c20, M=0x0000000108704a10) + 1776 at DwarfDebug.cpp:218
    frame #14: 0x0000000101a88e15 librustc-4283bb68-0.11-pre.dylib`DwarfDebug(this=0x0000000109804200, A=0x00000001087d8c20, M=0x0000000108704a10) + 37 at DwarfDebug.cpp:220
    frame #15: 0x0000000101a506f3 librustc-4283bb68-0.11-pre.dylib`llvm::AsmPrinter::doInitialization(this=0x00000001087d8c20, M=0x0000000108704a10) + 1811 at AsmPrinter.cpp:231
    frame #16: 0x000000010262a3c3 librustc-4283bb68-0.11-pre.dylib`llvm::FPPassManager::doInitialization(this=0x000000010a020170, M=0x0000000108704a10) + 99 at LegacyPassManager.cpp:1564
    frame #17: 0x000000010262ab78 librustc-4283bb68-0.11-pre.dylib`(anonymous namespace)::MPPassManager::runOnModule(this=0x000000010645f630, M=0x0000000108704a10) + 1000 at LegacyPassManager.cpp:1598
    frame #18: 0x000000010262a5ce librustc-4283bb68-0.11-pre.dylib`llvm::legacy::PassManagerImpl::run(this=0x00000001064949d0, M=0x0000000108704a10) + 302 at LegacyPassManager.cpp:1720
    frame #19: 0x000000010262b491 librustc-4283bb68-0.11-pre.dylib`llvm::legacy::PassManager::run(this=0x000000010a0925a0, M=0x0000000108704a10) + 33 at LegacyPassManager.cpp:1755
    frame #20: 0x00000001010aef80 librustc-4283bb68-0.11-pre.dylib`LLVMRustWriteOutputFile(Target=0x0000000109827600, PMR=0x000000010a0925a0, M=0x0000000108704a10, path=0x000000010a00c5b0, FileType=CGFT_ObjectFile) + 832 at PassWrapper.cpp:187
    frame #21: 0x0000000100e86d6f librustc-4283bb68-0.11-pre.dylib`back::link::WriteOutputFile::closure.83915 + 127
    frame #22: 0x000000010025f5b8 librustc-4283bb68-0.11-pre.dylib`c_str::CString::with_ref::h67bfc77600f111fdg0v::v0.11.pre + 152
    frame #23: 0x0000000100e86cb0 librustc-4283bb68-0.11-pre.dylib`c_str::ToCStr::with_c_str::h649f3d0125be42b1V9P::v0.11.pre + 112
    frame #24: 0x0000000100e86c25 librustc-4283bb68-0.11-pre.dylib`back::link::WriteOutputFile::h613b65c16e8d30bcUv1::v0.11.pre + 165
    frame #25: 0x0000000100e8cdd7 librustc-4283bb68-0.11-pre.dylib`back::link::write::run_passes::closure.83984 + 103
    frame #26: 0x0000000100e8c8fc librustc-4283bb68-0.11-pre.dylib`back::link::write::run_passes::with_codegen::hf1bba93ca8ea702anI1::v0.11.pre + 156
    frame #27: 0x0000000100e8ccd5 librustc-4283bb68-0.11-pre.dylib`back::link::write::run_passes::closure.83982 + 229
    frame #28: 0x00000001008e2715 librustc-4283bb68-0.11-pre.dylib`util::common::time::hd17fee6f98ebc873VZh::v0.11.pre + 101
    frame #29: 0x0000000100e88206 librustc-4283bb68-0.11-pre.dylib`back::link::write::run_passes::h7c53c9fff7a4a3569x1::v0.11.pre + 4918
    frame #30: 0x00000001010235e3 librustc-4283bb68-0.11-pre.dylib`driver::driver::phase_5_run_llvm_passes::closure.90380 + 147
    frame #31: 0x00000001008e2715 librustc-4283bb68-0.11-pre.dylib`util::common::time::hd17fee6f98ebc873VZh::v0.11.pre + 101
    frame #32: 0x00000001010234b8 librustc-4283bb68-0.11-pre.dylib`driver::driver::phase_5_run_llvm_passes::h992d8bb755f4d822yVf::v0.11.pre + 520
    frame #33: 0x0000000101028b93 librustc-4283bb68-0.11-pre.dylib`driver::driver::compile_input::h9c6393b1dbe53bc1xag::v0.11.pre + 3875
    frame #34: 0x0000000101077ea4 librustc-4283bb68-0.11-pre.dylib`run_compiler::hadccb7a29096a1ab4Gn::v0.11.pre + 8020
    frame #35: 0x00000001010a90d6 librustc-4283bb68-0.11-pre.dylib`main_args::closure.92321 + 86
    frame #36: 0x00000001010a466a librustc-4283bb68-0.11-pre.dylib`monitor::closure.92199 + 234
    frame #37: 0x00000001010967a4 librustc-4283bb68-0.11-pre.dylib`task::TaskBuilder::try::closure.91965 + 68
    frame #38: 0x000000010007e394 libnative-83574243-0.11-pre.dylib`task::spawn_opts::closure.7781 + 68
    frame #39: 0x0000000105d29a6c libstd-aad93cea-0.11-pre.dylib`unstable::finally::_$x7c$x7c.$x20$x27a$x20.$GT$$x20T.Finally$LT$T$GT$::finally::closure.40007 + 76
    frame #40: 0x0000000105d29949 libstd-aad93cea-0.11-pre.dylib`unstable::finally::try_finally::h7b5dce0c97463d98wMT::v0.11.pre + 89
    frame #41: 0x0000000105d298e2 libstd-aad93cea-0.11-pre.dylib`unstable::finally::_$x7c$x7c.$x20$x27a$x20.$GT$$x20T.Finally$LT$T$GT$::finally::he3252c2706ad38fecLT::v0.11.pre + 130
    frame #42: 0x0000000105d2984d libstd-aad93cea-0.11-pre.dylib`rt::task::Task::run::closure.40002 + 77
    frame #43: 0x0000000105d33b72 libstd-aad93cea-0.11-pre.dylib`rt::unwind::Unwinder::try::try_fn::__rust_abi + 98
    frame #44: 0x0000000105d33a32 libstd-aad93cea-0.11-pre.dylib`rt::unwind::Unwinder::try::try_fn::h1832ab126c831274z09::v0.11.pre + 66
    frame #45: 0x0000000105d419fc libstd-aad93cea-0.11-pre.dylib`rust_try + 12
    frame #46: 0x0000000105d2a378 libstd-aad93cea-0.11-pre.dylib`rt::unwind::Unwinder::try::h476c3fb682ff096aHY9::v0.11.pre + 120
    frame #47: 0x0000000105d296dc libstd-aad93cea-0.11-pre.dylib`rt::task::Task::run::h8de48cc50f018c3cS37::v0.11.pre + 220
    frame #48: 0x000000010007e155 libnative-83574243-0.11-pre.dylib`task::spawn_opts::closure.7753 + 485
    frame #49: 0x0000000105d308e3 libstd-aad93cea-0.11-pre.dylib`rt::thread::thread_start::__rust_abi + 99
    frame #50: 0x0000000105d30875 libstd-aad93cea-0.11-pre.dylib`rt::thread::thread_start::hc37897b3c1d0bcbfDI8::v0.11.pre + 21
    frame #51: 0x00007fff8a9bc899 libsystem_pthread.dylib`_pthread_body + 138
    frame #52: 0x00007fff8a9bc72a libsystem_pthread.dylib`_pthread_start + 137

Unfortunately, I cannot provide a small demo code to reproduce this (can reproduce only on the big project).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions