<p dir="auto">When i'm trying to compile this file:<br>
<a href="https://github.com/saati/skiplist-rs/blob/master/src/skiplist.rs">https://github.com/saati/skiplist-rs/blob/master/src/skiplist.rs</a></p>
<p dir="auto">with <code class="notranslate">rustc -O -g --test</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="bjb@b:~/code/skiplist-rs$ rustc -O -g --test src/skiplist.rs 
rustc: /home/bjb/src/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:179: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(llvm::MDNode*): Assertion `DISubprogram(Scope).describes(MF-&gt;getFunction())' failed.
Aborted"><pre class="notranslate"><code class="notranslate">bjb@b:~/code/skiplist-rs$ rustc -O -g --test src/skiplist.rs 
rustc: /home/bjb/src/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp:179: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(llvm::MDNode*): Assertion `DISubprogram(Scope).describes(MF-&gt;getFunction())' failed.
Aborted
</code></pre></div>
<p dir="auto">As of the last LLVM update RUSTFLAGS="-g" is once again broken:</p>
<p dir="auto">I bisected LLVM and traced it down to this commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/llvm/commit/503af43f3cc16be6b37d1d9b17d01f1e78c12a1a/hovercard" href="https://github.com/rust-lang/llvm/commit/503af43f3cc16be6b37d1d9b17d01f1e78c12a1a">rust-lang/llvm@<tt>503af43</tt></a></p>
<p dir="auto">Here is a backtrace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="-&gt; % gdb --args x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 -g -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-linux-gnu  -D warnings -L &quot;x86_64-unknown-linux-gnu/rt&quot; -L &quot;/scratch/laden/rust/build/x86_64-unknown-linux-gnu/llvm/Debug+Asserts/lib&quot; -L &quot;&quot;  --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib /scratch/laden/rust/src/libcore/lib.rs
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
and &quot;show warranty&quot; for details.
This GDB was configured as &quot;x86_64-linux-gnu&quot;.
For bug reporting instructions, please see:
&lt;http://www.gnu.org/software/gdb/bugs/&gt;...
Reading symbols from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc...done.
(gdb) r
Starting program: /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 -g -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-linux-gnu -D warnings -L x86_64-unknown-linux-gnu/rt -L /scratch/laden/rust/build/x86_64-unknown-linux-gnu/llvm/Debug+Asserts/lib -L '' --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib /scratch/laden/rust/src/libcore/lib.rs
[Thread debugging using libthread_db enabled]
Using host libthread_db library &quot;/lib/x86_64-linux-gnu/libthread_db.so.1&quot;.
[New Thread 0x7ffff1bff480 (LWP 5578)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1bff480 (LWP 5578)]
0x00007ffff572d772 in llvm::PointerIntPair&lt;llvm::Value*, 2u, unsigned int, llvm::PointerLikeTypeTraits&lt;llvm::Value*&gt; &gt;::getPointer (this=0xb8) at /scratch/laden/rust/src/llvm/include/llvm/ADT/PointerIntPair.h:76
76                               reinterpret_cast&lt;void*&gt;(Value &amp; PointerBitMask));
(gdb) bt
#0  0x00007ffff572d772 in llvm::PointerIntPair&lt;llvm::Value*, 2u, unsigned int, llvm::PointerLikeTypeTraits&lt;llvm::Value*&gt; &gt;::getPointer (this=0xb8) at /scratch/laden/rust/src/llvm/include/llvm/ADT/PointerIntPair.h:76
#1  0x00007ffff571fe0c in llvm::ValueHandleBase::getValPtr (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:103
#2  0x00007ffff5f515b0 in llvm::AssertingVH&lt;llvm::MDNode const&gt;::getValPtr (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:195
#3  0x00007ffff5f49874 in llvm::AssertingVH&lt;llvm::MDNode const&gt;::operator llvm::MDNode const* (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:222
#4  0x00007ffff5f3a0b0 in llvm::LexicalScope::getScopeNode (this=0xa0) at /scratch/laden/rust/src/llvm/include/llvm/CodeGen/LexicalScopes.h:59
#5  0x00007ffff5f43af5 in llvm::DwarfDebug::endFunction (this=0x3eb1840, MF=0x2572620) at /scratch/laden/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1528
#6  0x00007ffff5f264a4 in llvm::AsmPrinter::EmitFunctionBody (this=0x2401390) at /scratch/laden/rust/src/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:864
#7  0x00007ffff5bf8547 in llvm::X86AsmPrinter::runOnMachineFunction (this=0x2401390, MF=...) at /scratch/laden/rust/src/llvm/lib/Target/X86/X86AsmPrinter.cpp:64
#8  0x00007ffff609e1eb in llvm::MachineFunctionPass::runOnFunction (this=0x2401390, F=...) at /scratch/laden/rust/src/llvm/lib/CodeGen/MachineFunctionPass.cpp:33
#9  0x00007ffff6784eab in llvm::FPPassManager::runOnFunction (this=0x1378560, F=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1545
#10 0x00007ffff678509c in llvm::FPPassManager::runOnModule (this=0x1378560, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1565
#11 0x00007ffff67853f9 in (anonymous namespace)::MPPassManager::runOnModule (this=0x372e0e0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1623
#12 0x00007ffff6785aaf in llvm::legacy::PassManagerImpl::run (this=0x24230f0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1730
#13 0x00007ffff6785cd5 in llvm::legacy::PassManager::run (this=0x32fc3b0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1767
#14 0x00007ffff571b397 in LLVMRustWriteOutputFile (Target=0x45197d0, PMR=0x32fc3b0, M=0x539ec0, path=&lt;optimized out&gt;, FileType=llvm::TargetMachine::CGFT_ObjectFile) at /scratch/laden/rust/src/rustllvm/PassWrapper.cpp:202
#15 0x00007ffff55756ed in rustc::back::link::write_output_file (sess=0x7ffff1bf4be8, target=0x45197d0, pm=0x32fc3b0, m=0x539ec0, output=&lt;optimized out&gt;, file_type=ObjectFile) at /scratch/laden/rust/src/librustc/back/link.rs:78
#16 0x00007ffff557d170 in fn105947 (cpm=0x32fc3b0) at /scratch/laden/rust/src/librustc/back/link.rs:341
#17 with_codegen (tm=0x45197d0, llmod=0x539ec0, no_builtins=&lt;optimized out&gt;, f=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustc/back/link.rs:288
#18 fn105943 () at /scratch/laden/rust/src/librustc/back/link.rs:340
#19 0x00007ffff5577b89 in rustc::back::link::write::run_passes (sess=0x25db070, trans=&lt;optimized out&gt;, output=&lt;optimized out&gt;, output_types=...) at /scratch/laden/rust/src/librustc/back/link.rs:337
#20 0x00007ffff56c3751 in fn117831 () at /scratch/laden/rust/src/librustc/driver/driver.rs:436
#21 0x00007ffff562aeb1 in rustc::driver::driver::phase_5_run_llvm_passes (sess=&lt;optimized out&gt;, trans=&lt;optimized out&gt;, outputs=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustc/driver/driver.rs:435
#22 0x00007ffff561f9f0 in rustc::driver::driver::compile_input (sess=..., cfg=..., input=&lt;optimized out&gt;, outdir=&lt;optimized out&gt;, output=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustc/driver/driver.rs:100
#23 0x00007ffff56e5b29 in rustc::driver::run_compiler (args=...) at /scratch/laden/rust/src/librustc/driver/mod.rs:104
#24 0x00007ffff56e3446 in fn118655 () at /scratch/laden/rust/src/librustc/driver/mod.rs:40
#25 0x00007ffff56f875b in task::TaskBuilder$LT$S$GT$::try_future::closure.119840 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d252d482-0.11.0-pre.so
#26 0x00007ffff56f8603 in task::TaskBuilder$LT$S$GT$::spawn_internal::closure.119821 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d252d482-0.11.0-pre.so
#27 0x00007ffff7fc5c6c in fn7705 () at /scratch/laden/rust/src/libnative/task.rs:95
#28 0x00007ffff4235948 in task::Task::run::closure.5378 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt-d8560cb2-0.11.0-pre.so
#29 0x00007ffff429beac in rust_try () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt-d8560cb2-0.11.0-pre.so
#30 0x00007ffff423838a in rustrt::unwind::try (f=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustrt/unwind.rs:151
#31 0x00007ffff42357fa in rustrt::task::Task::run (self=0x7ffff1c1d1e0, f=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustrt/local.rs:32
#32 0x00007ffff7fc5ae3 in fn7679 () at /scratch/laden/rust/src/libnative/task.rs:95
#33 0x00007ffff42379c7 in thread::thread_start::h1f70d5c4c9ce8948kdd::v0.11.0.pre () at /scratch/laden/rust/src/librustrt/thread.rs:49
#34 0x00007ffff39d0b50 in start_thread (arg=&lt;optimized out&gt;) at pthread_create.c:304
#35 0x00007ffff3f0f0ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#36 0x0000000000000000 in ?? ()
(gdb)"><pre class="notranslate"><code class="notranslate">-&gt; % gdb --args x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 -g -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-linux-gnu  -D warnings -L "x86_64-unknown-linux-gnu/rt" -L "/scratch/laden/rust/build/x86_64-unknown-linux-gnu/llvm/Debug+Asserts/lib" -L ""  --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib /scratch/laden/rust/src/libcore/lib.rs
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
&lt;http://www.gnu.org/software/gdb/bugs/&gt;...
Reading symbols from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc...done.
(gdb) r
Starting program: /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 -g -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-linux-gnu -D warnings -L x86_64-unknown-linux-gnu/rt -L /scratch/laden/rust/build/x86_64-unknown-linux-gnu/llvm/Debug+Asserts/lib -L '' --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib /scratch/laden/rust/src/libcore/lib.rs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1bff480 (LWP 5578)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1bff480 (LWP 5578)]
0x00007ffff572d772 in llvm::PointerIntPair&lt;llvm::Value*, 2u, unsigned int, llvm::PointerLikeTypeTraits&lt;llvm::Value*&gt; &gt;::getPointer (this=0xb8) at /scratch/laden/rust/src/llvm/include/llvm/ADT/PointerIntPair.h:76
76                               reinterpret_cast&lt;void*&gt;(Value &amp; PointerBitMask));
(gdb) bt
#0  0x00007ffff572d772 in llvm::PointerIntPair&lt;llvm::Value*, 2u, unsigned int, llvm::PointerLikeTypeTraits&lt;llvm::Value*&gt; &gt;::getPointer (this=0xb8) at /scratch/laden/rust/src/llvm/include/llvm/ADT/PointerIntPair.h:76
#1  0x00007ffff571fe0c in llvm::ValueHandleBase::getValPtr (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:103
#2  0x00007ffff5f515b0 in llvm::AssertingVH&lt;llvm::MDNode const&gt;::getValPtr (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:195
#3  0x00007ffff5f49874 in llvm::AssertingVH&lt;llvm::MDNode const&gt;::operator llvm::MDNode const* (this=0xa8) at /scratch/laden/rust/src/llvm/include/llvm/IR/ValueHandle.h:222
#4  0x00007ffff5f3a0b0 in llvm::LexicalScope::getScopeNode (this=0xa0) at /scratch/laden/rust/src/llvm/include/llvm/CodeGen/LexicalScopes.h:59
#5  0x00007ffff5f43af5 in llvm::DwarfDebug::endFunction (this=0x3eb1840, MF=0x2572620) at /scratch/laden/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1528
#6  0x00007ffff5f264a4 in llvm::AsmPrinter::EmitFunctionBody (this=0x2401390) at /scratch/laden/rust/src/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:864
#7  0x00007ffff5bf8547 in llvm::X86AsmPrinter::runOnMachineFunction (this=0x2401390, MF=...) at /scratch/laden/rust/src/llvm/lib/Target/X86/X86AsmPrinter.cpp:64
#8  0x00007ffff609e1eb in llvm::MachineFunctionPass::runOnFunction (this=0x2401390, F=...) at /scratch/laden/rust/src/llvm/lib/CodeGen/MachineFunctionPass.cpp:33
#9  0x00007ffff6784eab in llvm::FPPassManager::runOnFunction (this=0x1378560, F=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1545
#10 0x00007ffff678509c in llvm::FPPassManager::runOnModule (this=0x1378560, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1565
#11 0x00007ffff67853f9 in (anonymous namespace)::MPPassManager::runOnModule (this=0x372e0e0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1623
#12 0x00007ffff6785aaf in llvm::legacy::PassManagerImpl::run (this=0x24230f0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1730
#13 0x00007ffff6785cd5 in llvm::legacy::PassManager::run (this=0x32fc3b0, M=...) at /scratch/laden/rust/src/llvm/lib/IR/LegacyPassManager.cpp:1767
#14 0x00007ffff571b397 in LLVMRustWriteOutputFile (Target=0x45197d0, PMR=0x32fc3b0, M=0x539ec0, path=&lt;optimized out&gt;, FileType=llvm::TargetMachine::CGFT_ObjectFile) at /scratch/laden/rust/src/rustllvm/PassWrapper.cpp:202
#15 0x00007ffff55756ed in rustc::back::link::write_output_file (sess=0x7ffff1bf4be8, target=0x45197d0, pm=0x32fc3b0, m=0x539ec0, output=&lt;optimized out&gt;, file_type=ObjectFile) at /scratch/laden/rust/src/librustc/back/link.rs:78
#16 0x00007ffff557d170 in fn105947 (cpm=0x32fc3b0) at /scratch/laden/rust/src/librustc/back/link.rs:341
#17 with_codegen (tm=0x45197d0, llmod=0x539ec0, no_builtins=&lt;optimized out&gt;, f=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustc/back/link.rs:288
#18 fn105943 () at /scratch/laden/rust/src/librustc/back/link.rs:340
#19 0x00007ffff5577b89 in rustc::back::link::write::run_passes (sess=0x25db070, trans=&lt;optimized out&gt;, output=&lt;optimized out&gt;, output_types=...) at /scratch/laden/rust/src/librustc/back/link.rs:337
#20 0x00007ffff56c3751 in fn117831 () at /scratch/laden/rust/src/librustc/driver/driver.rs:436
#21 0x00007ffff562aeb1 in rustc::driver::driver::phase_5_run_llvm_passes (sess=&lt;optimized out&gt;, trans=&lt;optimized out&gt;, outputs=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustc/driver/driver.rs:435
#22 0x00007ffff561f9f0 in rustc::driver::driver::compile_input (sess=..., cfg=..., input=&lt;optimized out&gt;, outdir=&lt;optimized out&gt;, output=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustc/driver/driver.rs:100
#23 0x00007ffff56e5b29 in rustc::driver::run_compiler (args=...) at /scratch/laden/rust/src/librustc/driver/mod.rs:104
#24 0x00007ffff56e3446 in fn118655 () at /scratch/laden/rust/src/librustc/driver/mod.rs:40
#25 0x00007ffff56f875b in task::TaskBuilder$LT$S$GT$::try_future::closure.119840 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d252d482-0.11.0-pre.so
#26 0x00007ffff56f8603 in task::TaskBuilder$LT$S$GT$::spawn_internal::closure.119821 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustc-d252d482-0.11.0-pre.so
#27 0x00007ffff7fc5c6c in fn7705 () at /scratch/laden/rust/src/libnative/task.rs:95
#28 0x00007ffff4235948 in task::Task::run::closure.5378 () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt-d8560cb2-0.11.0-pre.so
#29 0x00007ffff429beac in rust_try () from /scratch/laden/rust/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/librustrt-d8560cb2-0.11.0-pre.so
#30 0x00007ffff423838a in rustrt::unwind::try (f=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustrt/unwind.rs:151
#31 0x00007ffff42357fa in rustrt::task::Task::run (self=0x7ffff1c1d1e0, f=&lt;optimized out&gt;) at /scratch/laden/rust/src/librustrt/local.rs:32
#32 0x00007ffff7fc5ae3 in fn7679 () at /scratch/laden/rust/src/libnative/task.rs:95
#33 0x00007ffff42379c7 in thread::thread_start::h1f70d5c4c9ce8948kdd::v0.11.0.pre () at /scratch/laden/rust/src/librustrt/thread.rs:49
#34 0x00007ffff39d0b50 in start_thread (arg=&lt;optimized out&gt;) at pthread_create.c:304
#35 0x00007ffff3f0f0ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#36 0x0000000000000000 in ?? ()
(gdb)
</code></pre></div>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/michaelwoerister/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/michaelwoerister">@michaelwoerister</a></p>