<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75301>75301</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-18 crash: Assertion `memvt.getStoreSize().getKnownMinValue() <= MMO->getSize() && "Size mismatch!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
Clang-18 with -mgeneral-regs-only -c crashes on the test case.
Compiler explorer (assertion trunk): https://godbolt.org/z/ecnrGMdav
```
$cat mutant.c
typedef long double a __attribute__((vector_size (16)));
a
add (a one, a two)
{
return one + two;
}
$clang-18 -mgeneral-regs-only -c mutant.c
fatal error: error in backend: Cannot select: 0x55560eb9b320: i64 = build_pair 0x55560eb9b6a0, undef:i32
0x55560eb9b6a0: i32,ch = CopyFromReg 0x55560eb9b8d0:1, Register:i32 %14
0x55560eb9b7f0: i32 = Register %14
0x55560eb9e720: i32 = undef
In function: add
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang-18 -mgeneral-regs-only -c mutant.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'mutant.c'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@add'
#0 0x00007fd33ceb2266 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd2b266)
#1 0x00007fd33ceb0170 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd29170)
#2 0x00007fd33ceb18c4 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd2a8c4)
#3 0x00007fd33cdff9ae (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc789ae)
#4 0x00007fd33cdff96b (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc7896b)
#5 0x00007fd33ceaca67 llvm::sys::Process::Exit(int, bool) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd25a67)
#6 0x000055560d5e6c23 (/usr/lib/llvm-18/bin/clang+0x13c23)
#7 0x00007fd33ce0dc4f llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc86c4f)
#8 0x00007fd33d704100 llvm::SelectionDAGISel::isOrEquivalentToAdd(llvm::SDNode const*) const (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x157d100)
#9 0x00007fd33d7035e8 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x157c5e8)
#10 0x00007fd33fa9a455 (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x3913455)
#11 0x00007fd33d6fb1ec llvm::SelectionDAGISel::DoInstructionSelection() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x15741ec)
#12 0x00007fd33d6fa8e1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x15738e1)
#13 0x00007fd33d6f9b71 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x1572b71)
#14 0x00007fd33d6f7cf6 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x1570cf6)
#15 0x00007fd33fa9052f (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x390952f)
#16 0x00007fd33d266552 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0x10df552)
#17 0x00007fd33cff80df llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xe710df)
#18 0x00007fd33cffddc3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xe76dc3)
#19 0x00007fd33cff87d4 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xe717d4)
#20 0x00007fd34569509f clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1ade09f)
#21 0x00007fd345a2b5fe (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1e745fe)
#22 0x00007fd344647866 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xa90866)
#23 0x00007fd34649f645 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x28e8645)
#24 0x00007fd34641dcc4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x2866cc4)
#25 0x00007fd34651a1c0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x29631c0)
#26 0x000055560d5e6837 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x13837)
#27 0x000055560d5e3905 (/usr/lib/llvm-18/bin/clang+0x10905)
#28 0x00007fd3460b5909 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24fe909)
#29 0x00007fd33cdff94c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xc7894c)
#30 0x00007fd3460b52ae clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24fe2ae)
#31 0x00007fd34607d0f1 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24c60f1)
#32 0x00007fd34607d33e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24c633e)
#33 0x00007fd34609939c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x24e239c)
#34 0x000055560d5e325c clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-18/bin/clang+0x1025c)
#35 0x000055560d5f0f32 main (/usr/lib/llvm-18/bin/clang+0x1df32)
#36 0x00007fd33b396c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#37 0x000055560d5e01ea _start (/usr/lib/llvm-18/bin/clang+0xd1ea)
clang-18: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 18.0.0 (++20231018091808+48a53509e851-1~exp1~20231018091910.1571)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-18: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-18: note: diagnostic msg: /tmp/mutant-fe7d4a.c
clang-18: note: diagnostic msg: /tmp/mutant-fe7d4a.sh
clang-18: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Wltz46qy_jXKC2UXAl0f8uA4cWbWSXZSSfacU-fFhaDlcEYGb0C5rIf9208hybZwkp25eK0p18RGTffXTdMXELNWrhTAaZSeRen5CWvdozankq2Z0up1rVvL7UmlxevpvGFqNYkL9CzdI5qsV6DAsGZiYGUnWjWvaMIRN8w-gkVaIfcIyIF1iDML0wifR3g21-uNbMAgeNk02oBBESmYtWCc9FNMq75HpIzoDD06t7ERnUVkEZHFSotKN26qzSoiiz8jsgCuzOW1YE895yjDw6f_SRLOHFq3jik35f2ge92AgBo1Wq2Q0G3VAGJouWTOGVm1DpbLiBQRKZ6AO22WVv4JHmCceUz9h54NArr_2fBHiE4RpBVEZI4Ycs_aU_ek-TAHIQOuNcqToYicdVQ7hvn5mLNXYGvwD2wdKlczxxoExmjjzdd9QVKhivHvoIQfmzOltEMWGuDOD-CXNE0zDFVZUYL9iMwSFNFzVLWyEcsNk2ZMlDHs1WuVgDqiM0nJVrEDIs-JkojM-WPHbq43rwuj13ewGpMWwpPGnucdrKR1YHq2KCJpnGyZB-zzesu-47ydF87Y00NOAvoee0f2VaG6Vdx7nqdgQvTjt1cXs_sLZNtqLR1iqGpXyMBGG4ecPvRL6R7basr1OiKLpnna_plsjP4_b2WykNa2YCOyQEwJJBVvWgHd7ug2S7dAzjDeec7GwMZoDtaCQFa3ph_2M5m1mkvmQCDTKmS5kRs37Kt7x_h3JNr1xiPrhvAUdf9ujV4ZtkbMrNo1KOexo59zrXhgFdE56DqiF2jDjAWDmEOgBNI1qmUDPTGZorkWgHq-nXG7cTowuWuVkmqFNsxaFJF8MSwBuvUD10yxFZiI5D6ErLVoG79V8h0gkg8qJx_w-58iQ-ezy0lEL85nl-irss60vYT7zvE9op79dvX9tCjB3gFIPrhQRChG-AVjjPNaUMqhIiTLULfGd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