<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115013>115013</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Linux kernel vmlinux.o with clang lto "Assertion '__n < this->size()' failed"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
VincentAhluwalia
</td>
</tr>
</table>
<pre>
Hi,
I've used clang LTO in the kernel on many machines without issue but I got one where it gets this error every time no matter the kernel version and even after many reinstalls. It always happens at vmlinux.o. RAM definitely isn't the usage.
Didn't explicitly specify KCFLAGS all I did was "sudo make LLVM=1 LLVM_IAS=1" with Clang FullLTO enabled in the kernel.
This particular crash is on Kernel 6.11.6 but I get the same on 6.6.58 and 6.6.52.
I'm not a developer. I hope this is the right place to post this.
Error:
```
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_vector.h:1128: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = llvm::SUnit; _Alloc = std::allocator<llvm::SUnit>; reference = llvm::SUnit&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ld.lld -m elf_x86_64 -mllvm -import-instr-limit=5 -z noexecstack -r -o vmlinux.o -T .tmp_initcalls.lds --whole-archive vmlinux.a --no-whole-archive --start-group lib/lib.a arch/x86/lib/lib.a --end-group
1. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
2. Running pass 'X86 DAG->DAG Instruction Selection' on function '@ip6_rcv_core'
#0 0x00007fa2a9b55ad1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0xb6bad1)
#1 0x00007fa2a9b5281b llvm::sys::RunSignalHandlers() (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0xb6881b)
#2 0x00007fa2a9b52965 (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0xb68965)
#3 0x00007fa2a8b54240 (/usr/lib64/libc.so.6+0x41240)
#4 0x00007fa2a8baffdb pthread_kill (/usr/lib64/libc.so.6+0x9cfdb)
#5 0x00007fa2a8b54192 raise (/usr/lib64/libc.so.6+0x41192)
#6 0x00007fa2a8b374ef abort (/usr/lib64/libc.so.6+0x244ef)
#7 0x00007fa2a8e15e9b (/usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6+0xe4e9b)
#8 0x00007fa2aa635bbf llvm::ScheduleDAGSDNodes::AddSchedEdges() (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x164bbbf)
#9 0x00007fa2aa62d44d (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x164344d)
#10 0x00007fa2aa716e6a llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x172ce6a)
#11 0x00007fa2aa719a19 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x172fa19)
#12 0x00007fa2aa71b793 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x1731793)
#13 0x00007fa2adc5d1b0 (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x4c731b0)
#14 0x00007fa2aa0aa310 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x10c0310)
#15 0x00007fa2a9d17cfc llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0xd2dcfc)
#16 0x00007fa2a9d1822c llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0xd2e22c)
#17 0x00007fa2a9d18969 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0xd2e969)
#18 0x00007fa2abac9ebd (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x2adfebd)
#19 0x00007fa2abaca5f2 llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x2ae05f2)
#20 0x00007fa2ababf251 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x2ad5251)
#21 0x00007fa2ababf698 llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/lib/llvm/18/bin/../lib64/libLLVM.so.18.1+0x2ad5698)
#22 0x00007fa2b1b26189 lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x19e189)
#23 0x00007fa2b1a824a7 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::endianness)1, true>>(bool) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0xfa4a7)
#24 0x00007fa2b1a91fd8 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x109fd8)
#25 0x00007fa2b1a93f4d lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x10bf4d)
#26 0x00007fa2b1a954ec lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/lib/llvm/18/bin/../lib64/liblldELF.so.18.1+0x10d4ec)
#27 0x00007fa2b1602c42 lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/lib/llvm/18/bin/../lib64/liblldCommon.so.18.1+0xfc42)
#28 0x00005598f0237e16 lld_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm/18/bin/ld.lld+0x3e16)
#29 0x00005598f0237576 main (/usr/lib/llvm/18/bin/ld.lld+0x3576)
#30 0x00007fa2a8b391bc (/usr/lib64/libc.so.6+0x261bc)
#31 0x00007fa2a8b39275 __libc_start_main (/usr/lib64/libc.so.6+0x26275)
#32 0x00005598f02375d1 _start (/usr/lib/llvm/18/bin/ld.lld+0x35d1)
make[2]: *** [scripts/Makefile.vmlinux_o:89: vmlinux.o] Error 134
make[1]: *** [/usr/src/linux-6.11.6-gentoo/Makefile:1139: vmlinux_o] Error 2
make: *** [Makefile:224: __sub-make] Error 2
```
Couldn't find similar bug reports. Any ideas?
[.config.txt](https://github.com/user-attachments/files/17635144/default.config.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWktv47iy_jXMhpAgUu9FFo4d9wSTvtPo5A7uzqDIks0bitIhqTzm1x9QchzTnenXeM4BBjBimY-qr74qFklVmLVyqwEuUX6F8tUFG92uN5e_S81Bu8VOjU9MSXbR9OLl8heJ6BIlK5Qs5r83iJaPgEcLAnPF9Bbf3v-GpcZuB_gBjAaFe407pl9wx_hOarD4SbpdPzosrR0BN6PDN3jbO9xrwE87MIClw1tw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