Bug 2226564 - llc optional: Assertion 'this->_M_is_engaged()' failed.
Summary: llc optional: Assertion 'this->_M_is_engaged()' failed.
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: llvm
Version: 39
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tom Stellard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-26 00:34 UTC by Josh Stone
Modified: 2024-11-27 21:26 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-11-27 21:26:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
reduced.bc (43.20 KB, application/octet-stream)
2023-07-26 00:35 UTC, Josh Stone
no flags Details
original reproducer (3.28 MB, application/octet-stream)
2023-07-27 19:40 UTC, Josh Stone
no flags Details
original no-opt reproducer (2.03 MB, application/octet-stream)
2023-07-28 19:55 UTC, Josh Stone
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github llvm llvm-project issues 64149 0 None open Assertion failure: "conflicting locations for variable" 2024-10-21 16:55:23 UTC
Github rust-lang rust issues 115113 0 None closed ScalarReplacementOfAggregates causes rustc to emit invalid LLVM debuginfo (and sometimes rustc segfaults) 2024-10-21 16:55:14 UTC
Github rust-lang rust issues 131944 0 None open [Regression] LLVM asserts "conflicting locations for variable" since 1.82 2024-10-21 16:55:02 UTC

Description Josh Stone 2023-07-26 00:34:48 UTC
While building a nightly version of the Rust toolchain, rustc->LLVM tripped an assertion in libstdc++'s optional header. I used "rustc -Csave-temps" to capture the last output before the crash, and applied llvm-reduce for a smaller test case, which I will attach.

Reproducible: Always

Steps to Reproduce:
1. llc reduced.bc

Actual Results:  
# llc reduced.bc
/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/optional:477: _Tp &std::_Optional_base_impl<llvm::DIExpression::FragmentInfo, std::_Optional_base<llvm::DIExpression::FragmentInfo, true, true>>::_M_get() [_Tp = llvm::DIExpression::FragmentInfo, _Dp = std::_Optional_base<llvm::DIExpression::FragmentInfo, true, true>]: Assertion 'this->_M_is_engaged()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc reduced.bc
1.      Running pass 'Function Pass Manager' on module 'reduced.bc'.
2.      Running pass 'X86 Assembly Printer' on function '@_RINvYNtNtNtNtCsgBM6TfnZ7YU_5cargo4util6config2de12DeserializerNtNtCs8ELY4rCNAV8_5serde2de12Deserializer21___deserialize_contentNtNtNtNtB12_9___private2de7content14ContentVisitorEBb_'
 #0 0x00007f7353ec49ca llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-16.so+0xcc49ca)
 #1 0x00007f7353ec2354 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-16.so+0xcc2354)
 #2 0x00007f7353ec557b (/lib64/libLLVM-16.so+0xcc557b)
 #3 0x00007f7352a3e9a0 __restore_rt (/lib64/libc.so.6+0x3e9a0)
 #4 0x00007f7352a90824 __pthread_kill_implementation (/lib64/libc.so.6+0x90824)
 #5 0x00007f7352a3e8ee gsignal (/lib64/libc.so.6+0x3e8ee)
 #6 0x00007f7352a268ff abort (/lib64/libc.so.6+0x268ff)
 #7 0x00007f7352edf1e0 __gnu_debug::_Safe_sequence_base::_M_get_mutex() (/lib64/libstdc++.so.6+0xdf1e0)
 #8 0x00007f73548b341c (/lib64/libLLVM-16.so+0x16b341c)
 #9 0x00007f73548b3766 (/lib64/libLLVM-16.so+0x16b3766)
#10 0x00007f7354897fe1 llvm::DbgVariable::getFrameIndexExprs() const (/lib64/libLLVM-16.so+0x1697fe1)
#11 0x00007f73548912b6 llvm::DwarfCompileUnit::constructVariableDIEImpl(llvm::DbgVariable const&, bool) (/lib64/libLLVM-16.so+0x16912b6)
#12 0x00007f73548901b2 llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-16.so+0x16901b2)
#13 0x00007f73548904c0 llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-16.so+0x16904c0)
#14 0x00007f735489062e llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-16.so+0x169062e)
#15 0x00007f735489062e llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-16.so+0x169062e)
#16 0x00007f73548904c0 llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-16.so+0x16904c0)
#17 0x00007f7354892533 llvm::DwarfCompileUnit::constructSubprogramScopeDIE(llvm::DISubprogram const*, llvm::LexicalScope*) (/lib64/libLLVM-16.so+0x1692533)
#18 0x00007f73548a5c3b llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) (/lib64/libLLVM-16.so+0x16a5c3b)
#19 0x00007f7354882a76 llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) (/lib64/libLLVM-16.so+0x1682a76)
#20 0x00007f735486b34c llvm::AsmPrinter::emitFunctionBody() (/lib64/libLLVM-16.so+0x166b34c)
#21 0x00007f7356de8d25 (/lib64/libLLVM-16.so+0x3be8d25)
#22 0x00007f73542e219c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib64/libLLVM-16.so+0x10e219c)
#23 0x00007f7354035a5e llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib64/libLLVM-16.so+0xe35a5e)
#24 0x00007f735403c853 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib64/libLLVM-16.so+0xe3c853)
#25 0x00007f73540361da llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM-16.so+0xe361da)
#26 0x000000000041096a main (/usr/bin/llc+0x41096a)
#27 0x00007f7352a2814a __libc_start_call_main (/lib64/libc.so.6+0x2814a)
#28 0x00007f7352a2820b __libc_start_main.5 (/lib64/libc.so.6+0x2820b)
#29 0x000000000040d9e5 _start (/usr/bin/llc+0x40d9e5)
Aborted (core dumped)



Reproducible on both llvm-16.0.6-4.fc39.x86_64 and llvm-16.0.6-1.fc38.x86_64.

Comment 1 Josh Stone 2023-07-26 00:35:39 UTC
Created attachment 1979987 [details]
reduced.bc

Comment 2 Josh Stone 2023-07-26 00:41:03 UTC
Here's a fuller backtrace from GDB:

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff04b08b3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff045fabe in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff044887f in __GI_abort () at abort.c:79
#4  0x00007ffff06df1e0 in std::__glibcxx_assert_fail (file=<optimized out>, line=<optimized out>, function=<optimized out>, condition=<optimized out>) at ../../../../../libstdc++-v3/src/c++11/debug.cc:61
#5  0x00007ffff20b256c in llvm::DbgVariable::getFrameIndexExprs() const::$_0::operator()(llvm::DbgVariable::FrameIndexExpr const&, llvm::DbgVariable::FrameIndexExpr const&) const (A=..., B=..., this=<optimized out>)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/predefined_ops.h:158
#6  __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0>::operator()<llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*>(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*) (
    this=<optimized out>, __it1=<optimized out>, __it2=<optimized out>) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/predefined_ops.h:158
#7  0x00007ffff20b28b6 in std::__insertion_sort<llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0> >(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0>) (__first=0x5cb490, __last=0x5cb4b0, __comp=...) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:1819
#8  0x00007ffff2096e61 in std::__final_insertion_sort<llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0> >(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0>) (__first=0x5cb490, __last=0x5cb4b0, __comp=...) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:1864
#9  std::__sort<llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0> >(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0>) (__first=0x5cb490, __last=0x5cb4b0, __comp=...) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:1950
#10 std::sort<llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0>(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0) (__first=0x5cb490,
    __last=0x5cb4b0, __comp=...) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:4894
#11 llvm::sort<llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0>(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0) (Start=0x5cb490,
    End=0x5cb4b0, Comp=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/include/llvm/ADT/STLExtras.h:1705
#12 llvm::sort<llvm::SmallVector<llvm::DbgVariable::FrameIndexExpr, 1u>&, llvm::DbgVariable::getFrameIndexExprs() const::$_0>(llvm::SmallVector<llvm::DbgVariable::FrameIndexExpr, 1u>&, llvm::DbgVariable::getFrameIndexExprs() const::$_0) (C=...,
    Comp=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/include/llvm/ADT/STLExtras.h:1710
#13 llvm::DbgVariable::getFrameIndexExprs (this=0x5cd630) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:282
#14 0x00007ffff2090136 in llvm::DwarfCompileUnit::constructVariableDIEImpl (this=0x5339a0, DV=..., Abstract=<optimized out>) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:853
#15 0x00007ffff208f032 in llvm::DwarfCompileUnit::constructVariableDIE (this=0x5339a0, DV=..., Abstract=<optimized out>) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:706
#16 llvm::DwarfCompileUnit::constructVariableDIE (this=0x5339a0, DV=..., Scope=..., ObjectPointer=<optimized out>) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:911
#17 llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x5339a0, Scope=0x5cbca8, ScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1063
#18 0x00007ffff208d731 in llvm::DwarfCompileUnit::constructScopeDIE (this=0x195333, Scope=0x195333, ParentScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/include/llvm/CodeGen/DIE.h:540
#19 0x00007ffff208f340 in llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x5339a0, Scope=<optimized out>, ScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1091
#20 0x00007ffff208f4ae in llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x5339a0, Scope=<optimized out>, ScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1093
#21 0x00007ffff208f4ae in llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x5339a0, Scope=<optimized out>, ScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1093
#22 0x00007ffff208d731 in llvm::DwarfCompileUnit::constructScopeDIE (this=0x195333, Scope=0x195333, ParentScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/include/llvm/CodeGen/DIE.h:540
#23 0x00007ffff208f340 in llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x5339a0, Scope=<optimized out>, ScopeDIE=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1091
#24 0x00007ffff20913b3 in llvm::DwarfCompileUnit::constructSubprogramScopeDIE (this=0x5339a0, Sub=0x44c140, Scope=0x5cba10) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1032
#25 0x00007ffff20a4cdb in llvm::DwarfDebug::endFunctionImpl (this=0x531dc0, MF=0x596180) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:2296
#26 0x00007ffff20819c6 in llvm::DebugHandlerBase::endFunction (this=0x531dc0, MF=0x596180) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp:410
#27 0x00007ffff206a117 in llvm::AsmPrinter::emitFunctionBody (this=0x4f7680) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1842
#28 0x00007ffff45f5665 in llvm::X86AsmPrinter::runOnMachineFunction (this=0x4f7680, MF=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/Target/X86/X86AsmPrinter.cpp:86
#29 0x00007ffff1adf53c in llvm::MachineFunctionPass::runOnFunction (this=0x4f7680, F=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/CodeGen/MachineFunctionPass.cpp:91
#30 0x00007ffff18335ae in llvm::FPPassManager::runOnFunction (this=0x4cfdd0, F=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/IR/LegacyPassManager.cpp:1430
#31 0x00007ffff183a303 in llvm::FPPassManager::runOnModule (this=0x4cfdd0, M=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/IR/LegacyPassManager.cpp:1476
#32 0x00007ffff1833d2a in (anonymous namespace)::MPPassManager::runOnModule (this=0x4cdf20, M=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/IR/LegacyPassManager.cpp:1545
#33 llvm::legacy::PassManagerImpl::run (this=0x4b21b0, M=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/lib/IR/LegacyPassManager.cpp:535
#34 0x000000000041096a in compileModule (argv=<optimized out>, Context=...) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/tools/llc/llc.cpp:733
#35 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/llvm-16.0.6-1.fc38.x86_64/tools/llc/llc.cpp:420

Comment 3 Nikita Popov 2023-07-27 08:53:41 UTC
I've filed https://github.com/llvm/llvm-project/issues/64149 with a slightly reduced test case.

Comment 4 Josh Stone 2023-07-27 19:40:21 UTC
Created attachment 1980333 [details]
original reproducer

Comment 5 Nikita Popov 2023-07-28 14:35:26 UTC
Do you also have the cargo-50f78329f19490ae.cargo.c1756bb5859f0146-cgu.10.rcgu.no-opt.bc file? I'd like to check whether the issue already exists in the input IR or only appears after optimization.

(The rust srpm would also work, it looks like the original copr link expired.)

Comment 6 Josh Stone 2023-07-28 19:55:58 UTC
Created attachment 1980523 [details]
original no-opt reproducer

Comment 7 Josh Stone 2023-07-28 20:01:53 UTC
I attached the no-opt, and uploaded the srpm here:
https://jistone.fedorapeople.org/bz2226564/rust-1.71.0-2.fc39.src.rpm

That verrel is not correct -- it's really a 1.73-nightly inside. If you build it in mock, it needs --enable-network to download beta stage0.

Comment 8 Fedora Release Engineering 2023-08-16 08:13:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 9 Josh Stone 2023-08-21 22:45:27 UTC
This problem has now appeared in a scratch build of rust-1.72.0~beta.11:
https://koji.fedoraproject.org/koji/taskinfo?taskID=105099384

Comment 10 Josh Stone 2024-10-18 20:09:06 UTC
This has recurred with the Rust 1.82.0 release, on all arches except i686 (which uses reduced debuginfo), but only on F39 (llvm-17.0.6-4.fc39).
https://koji.fedoraproject.org/koji/taskinfo?taskID=124928273

I haven't checked yet whether rustc regressed its previous fix, but it's working fine with later LLVM. The llc backtrace looks the same:

# llc cargo-a185cc43d450f64b.cargo.aa3fc091cd40aac9-cgu.0.rcgu.bc
/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/optional:479: _Tp &std::_Optional_base_impl<llvm::DIExpression::FragmentInfo, std::_Optional_base<llvm::DIExpression::FragmentInfo>>::_M_get() [_Tp = llvm::DIExpression::FragmentInfo, _Dp = std::_Optional_base<llvm::DIExpression::FragmentInfo>]: Assertion 'this->_M_is_engaged()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc cargo-a185cc43d450f64b.cargo.aa3fc091cd40aac9-cgu.0.rcgu.bc
1.      Running pass 'Function Pass Manager' on module 'cargo-a185cc43d450f64b.cargo.aa3fc091cd40aac9-cgu.0.rcgu.bc'.
2.      Running pass 'X86 Assembly Printer' on function '@_RINvXNvNtNtNtCseCemhvyppMb_5cargo4core8resolver6encodes2_1__NtB5_19EncodableDependencyNtNtCs6Qlu3ibpmqO_5serde3ser9Serialize9serializeNtNtCskgD2HeWghJi_4toml5value15ValueSerializerEBb_'
 #0 0x00007f8a6293df6a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-17.so+0x93df6a)
 #1 0x00007f8a6293b924 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-17.so+0x93b924)
 #2 0x00007f8a6293e7db (/lib64/libLLVM-17.so+0x93e7db)
 #3 0x00007f8a61a5c9a0 __restore_rt (/lib64/libc.so.6+0x3e9a0)
 #4 0x00007f8a61aae834 __pthread_kill_implementation (/lib64/libc.so.6+0x90834)
 #5 0x00007f8a61a5c8ee gsignal (/lib64/libc.so.6+0x3e8ee)
 #6 0x00007f8a61a448ff abort (/lib64/libc.so.6+0x268ff)
 #7 0x00007f8a61cd9600 std::chrono::_V2::system_clock::now() (/lib64/libstdc++.so.6+0xd9600)
 #8 0x00007f8a6337935c (/lib64/libLLVM-17.so+0x137935c)
 #9 0x00007f8a633796a6 (/lib64/libLLVM-17.so+0x13796a6)
#10 0x00007f8a6335d0f1 llvm::DbgVariable::getFrameIndexExprs() const (/lib64/libLLVM-17.so+0x135d0f1)
#11 0x00007f8a63355fc6 llvm::DwarfCompileUnit::constructVariableDIEImpl(llvm::DbgVariable const&, bool) (/lib64/libLLVM-17.so+0x1355fc6)
#12 0x00007f8a63353daf llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-17.so+0x1353daf)
#13 0x00007f8a63354e0e llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-17.so+0x1354e0e)
#14 0x00007f8a63354e0e llvm::DwarfCompileUnit::createAndAddScopeChildren(llvm::LexicalScope*, llvm::DIE&) (/lib64/libLLVM-17.so+0x1354e0e)
#15 0x00007f8a6335725b llvm::DwarfCompileUnit::constructSubprogramScopeDIE(llvm::DISubprogram const*, llvm::LexicalScope*) (/lib64/libLLVM-17.so+0x135725b)
#16 0x00007f8a6336b036 llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) (/lib64/libLLVM-17.so+0x136b036)
#17 0x00007f8a6334715b llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) (/lib64/libLLVM-17.so+0x134715b)
#18 0x00007f8a6332f60c llvm::AsmPrinter::emitFunctionBody() (/lib64/libLLVM-17.so+0x132f60c)
#19 0x00007f8a659d603f (/lib64/libLLVM-17.so+0x39d603f)
#20 0x00007f8a62d7c26c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib64/libLLVM-17.so+0xd7c26c)
#21 0x00007f8a62ab6025 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib64/libLLVM-17.so+0xab6025)
#22 0x00007f8a62abcc73 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib64/libLLVM-17.so+0xabcc73)
#23 0x00007f8a62ab66dd llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM-17.so+0xab66dd)
#24 0x0000000000410916 main (/usr/bin/llc+0x410916)
#25 0x00007f8a61a4614a __libc_start_call_main (/lib64/libc.so.6+0x2814a)
#26 0x00007f8a61a4620b __libc_start_main.5 (/lib64/libc.so.6+0x2820b)
#27 0x000000000040dad5 _start (/usr/bin/llc+0x40dad5)
Aborted (core dumped)

Or from GDB:

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff04ae8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff045c8ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff04448ff in __GI_abort () at abort.c:79
#4  0x00007ffff06d9600 in std::__glibcxx_assert_fail (file=<optimized out>, line=<optimized out>, function=<optimized out>, condition=<optimized out>) at ../../../../../libstdc++-v3/src/c++11/assert_fail.cc:41
#5  0x00007ffff1d7935c in std::_Optional_base_impl<llvm::DIExpression::FragmentInfo, std::_Optional_base<llvm::DIExpression::FragmentInfo, true, true> >::_M_get (this=<optimized out>)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/optional:479
#6  std::optional<llvm::DIExpression::FragmentInfo>::operator-> (this=<optimized out>) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/optional:968
#7  0x00007ffff1d7935c in llvm::DbgVariable::getFrameIndexExprs() const::$_0::operator()(llvm::DbgVariable::FrameIndexExpr const&, llvm::DbgVariable::FrameIndexExpr const&) const (A=..., B=..., this=<optimized out>) from /lib64/libLLVM-17.so
#8  __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0>::operator()<llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*> (this=<optimized out>, __it1=<optimized out>, __it2=<optimized out>)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/predefined_ops.h:158
#9  0x00007ffff1d796a6 in std::__insertion_sort<llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0> > (__first=0xaa4280b0, __last=0xaa4280d0, __comp=...)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:1819
#10 0x00007ffff1d5d0f1 in std::__final_insertion_sort<llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0> > (__first=0xaa4280b0, __last=0xaa4280d0, __comp=...)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:1864
#11 std::__sort<llvm::DbgVariable::FrameIndexExpr*, __gnu_cxx::__ops::_Iter_comp_iter<llvm::DbgVariable::getFrameIndexExprs() const::$_0> > (__first=0xaa4280b0, __last=0xaa4280d0, __comp=...)
    at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:1950
#12 std::sort<llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0>(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0) (__first=0xaa4280b0,
    __last=0xaa4280d0, __comp=...) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_algo.h:4894
#13 llvm::sort<llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0>(llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::FrameIndexExpr*, llvm::DbgVariable::getFrameIndexExprs() const::$_0) (Start=0xaa4280b0,
    End=0xaa4280d0, Comp=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/include/llvm/ADT/STLExtras.h:1684
#14 llvm::sort<llvm::SmallVector<llvm::DbgVariable::FrameIndexExpr, 1u>&, llvm::DbgVariable::getFrameIndexExprs() const::$_0>(llvm::SmallVector<llvm::DbgVariable::FrameIndexExpr, 1u>&, llvm::DbgVariable::getFrameIndexExprs() const::$_0) (C=...,
    Comp=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/include/llvm/ADT/STLExtras.h:1689
#15 llvm::DbgVariable::getFrameIndexExprs (this=0xa3bb0350) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:283
#16 0x00007ffff1d55fc6 in llvm::DwarfCompileUnit::constructVariableDIEImpl (this=0x54ca70, DV=..., Abstract=<optimized out>) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:898
#17 0x00007ffff1d53daf in llvm::DwarfCompileUnit::constructVariableDIE (this=0x54ca70, DV=..., Abstract=<optimized out>) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:751
#18 llvm::DwarfCompileUnit::constructVariableDIE (this=0x54ca70, DV=..., Scope=..., ObjectPointer=<optimized out>) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:956
#19 llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x54ca70, Scope=0xa9ca57b8, ScopeDIE=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1103
#20 0x00007ffff1d53355 in llvm::DwarfCompileUnit::constructScopeDIE (this=0x24, Scope=0x24, ParentScopeDIE=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/include/llvm/CodeGen/DIE.h:547
#21 0x00007ffff1d54e0e in llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x54ca70, Scope=0xa9b0ad80, ScopeDIE=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1138
#22 0x00007ffff1d53355 in llvm::DwarfCompileUnit::constructScopeDIE (this=0x24, Scope=0x24, ParentScopeDIE=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/include/llvm/CodeGen/DIE.h:547
#23 0x00007ffff1d54e0e in llvm::DwarfCompileUnit::createAndAddScopeChildren (this=0x54ca70, Scope=0xaacf8a20, ScopeDIE=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1138
#24 0x00007ffff1d5725b in llvm::DwarfCompileUnit::constructSubprogramScopeDIE (this=0x54ca70, Sub=0x5f3fde10, Scope=0xaacf8a20) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1077
#25 0x00007ffff1d6b036 in llvm::DwarfDebug::endFunctionImpl (this=0xe76650, MF=0x80849b50) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:2337
#26 0x00007ffff1d4715b in llvm::DebugHandlerBase::endFunction (this=0xe76650, MF=0x80849b50) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp:411
#27 0x00007ffff1d2f60c in llvm::AsmPrinter::emitFunctionBody (this=0x4bb9d0) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1900
#28 0x00007ffff43d603f in llvm::X86AsmPrinter::runOnMachineFunction (this=0x4bb9d0, MF=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/Target/X86/X86AsmPrinter.cpp:86
#29 0x00007ffff177c26c in llvm::MachineFunctionPass::runOnFunction (this=0x4bb9d0, F=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/CodeGen/MachineFunctionPass.cpp:91
#30 0x00007ffff14b6025 in llvm::FPPassManager::runOnFunction (this=0x4ec150, F=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/IR/LegacyPassManager.cpp:1435
#31 0x00007ffff14bcc73 in llvm::FPPassManager::runOnModule (this=0x4ec150, M=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/IR/LegacyPassManager.cpp:1481
#32 0x00007ffff14b66dd in (anonymous namespace)::MPPassManager::runOnModule (this=0x627d8fa0, M=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/IR/LegacyPassManager.cpp:1550
#33 llvm::legacy::PassManagerImpl::run (this=0x4eacf0, M=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/lib/IR/LegacyPassManager.cpp:535
#34 0x0000000000410916 in compileModule (argv=<optimized out>, Context=...) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/tools/llc/llc.cpp:751
#35 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/llvm-17.0.6-4.fc39.x86_64/tools/llc/llc.cpp:416

Comment 11 Josh Stone 2024-10-19 00:15:18 UTC
Bisecting Rust puts blame on https://github.com/rust-lang/rust/pull/128861

Comment 12 Josh Stone 2024-10-19 00:56:20 UTC
LLVM 19 with assertions fails too: https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/Help.20minimizing.20LLVM.20assertion.20reproducer.3F/near/477752885

rustc: /checkout/src/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:303: void llvm::Loc::MMI::addFrameIndexExpr(const DIExpression *, int): Assertion `(FrameIndexExprs.size() == 1 || llvm::all_of(FrameIndexExprs, [](const FrameIndexExpr &FIE) { return FIE.Expr && FIE.Expr->isFragment(); })) && "conflicting locations for variable"' failed.

Comment 13 Aoife Moloney 2024-11-08 11:00:35 UTC
This message is a reminder that Fedora Linux 39 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 39 on 2024-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '39'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 39 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 14 Aoife Moloney 2024-11-27 21:26:20 UTC
Fedora Linux 39 entered end-of-life (EOL) status on 2024-11-26.

Fedora Linux 39 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.