<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113870>113870</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-20: fatal error: error in backend: Cannot select: intrinsic %llvm.bpf.load.half
</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>
### Description
I encountered a crash in Clang when compiling my source code with the following options:
```sh
-O3 -ffast-math -fdiscard-value-names -fsanitize-address-poison-custom-array-cookie -Wall -Wextra -fno-strict-aliasing -fwrapv -g -fsanitize=address
```
These options together seem to trigger an internal error in the compiler, resulting in a bankend crash. The issue occurs consistently with my project when options are used.
The issue can also be reproduced on Compiler Explorer.[https://godbolt.org/z/4KPhqx7so](url)
### Code
[repro-f3f3a4.zip](https://github.com/user-attachments/files/17538266/repro-f3f3a4.zip)
### Command
```sh
clang repro-f3f3a4.c -O3 -ffast-math -fdiscard-value-names -fsanitize-address-poison-custom-array-cookie -Wall -Wextra -fno-strict-aliasing -fwrapv -g -fsanitize=address -c -o repro-f3f3a4.o
```
### Output
```sh
fatal error: error in backend: Cannot select: intrinsic %llvm.bpf.load.half
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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 -ffast-math -fdiscard-value-names -fsanitize-address-poison-custom-array-cookie -Wall -Wextra -fno-strict-aliasing -fwrapv -g -fsanitize=address <source>
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '<source>'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@repro_main'
#0 0x0000000003bd5b48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bd5b48)
#1 0x0000000003bd384c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bd384c)
#2 0x0000000003b21746 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b21746)
#3 0x0000000003bcab8e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bcab8e)
#4 0x0000000000ce1100 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#5 0x0000000003b2c7c3 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b2c7c3)
#6 0x0000000004eb0a78 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4eb0a78)
#7 0x0000000004eb66f9 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4eb66f9)
#8 0x00000000026d59a1 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#9 0x0000000004ead86b llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ead86b)
#10 0x0000000004ebc9f9 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ebc9f9)
#11 0x0000000004ebfac2 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ebfac2)
#12 0x0000000004ec0de0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ec0de0)
#13 0x0000000004eb1b3f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4eb1b3f)
#14 0x0000000002f3c849 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#15 0x0000000003539480 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3539480)
#16 0x0000000003539831 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3539831)
#17 0x000000000353a0e7 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x353a0e7)
#18 0x0000000003e83b15 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>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e83b15)
#19 0x000000000454b6ad clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x454b6ad)
#20 0x00000000066a031c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66a031c)
#21 0x000000000454ba98 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x454ba98)
#22 0x0000000004805949 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4805949)
#23 0x0000000004784bae clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4784bae)
#24 0x00000000048eb0ee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48eb0ee)
#25 0x0000000000ce35ff cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce35ff)
#26 0x0000000000cdb2ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x000000000458f029 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#28 0x0000000003b21684 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b21684)
#29 0x000000000458f61f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#30 0x000000000455564d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x455564d)
#31 0x000000000455673d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x455673d)
#32 0x000000000455db25 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x455db25)
#33 0x0000000000ce04a9 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xce04a9)
#34 0x0000000000bae764 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbae764)
#35 0x00007116d2029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#36 0x00007116d2029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#37 0x0000000000cdad7e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcdad7e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z2zbW_jX0DYYaEqRI6sIXsmSl6Zu88cTetnulAcFDCRsQUAHQlvvrdwBSEkHLdrqrdDqzHTe28HHwnAfnCxCI1mwjAK6D6U0wXV6R1mylumakIUKK50a2muqrUlbP1wFOuh-0BE0V2xkmRRAtg2j-EYGgshUGFFSIIKqI3iIm0IITsUFPWxCIymbHOBMb1DwjLVtFAVFZAXpiZovMFlAtOZdPdoR0snWQzDv5QRZ1P3rbNYRfEhTWNdEmbIjZorCumKZEVeEj4S2EgjSgUVhrIphhf0BIqkqB1uFOMi1FSFttZBMSpchzSKX8xgCh8FfCOQp_hb1RBIW1kKE2ilETEs6ItsDC-kmR3SMKNwPhQbLsxaMR3P6j-_dhCxoOmiEjN2C2oJAGaJCRyCi22YBCRCBmeRSEI1BKKkujZafjD1SAF0iBbrmxgJhABJVEfANRdbRP0MMWENO6BSQpbZVGVArNtAFh-HNHd_OMdkr-C6jpNucAiyhArYZqgkbQe4GUCES4lqgEpGCnZNVSqJAUaNHDQ7f7HZcK1CSY3myN2bldxKsArzayKiU3E6k2AV79EeBV-n9329_3uZbBdBngolU8wLPhyiebW8gK-rbpjVs6rJM6IenkD7brpo9WY2bblhMqmwCvWg0qJMYQum1AGB3gVc042N9xPk0KnGUBXr0Q-zqYpiGiesU4qTN6TxhFf1eLRSFFofTRyjfM-ETCl9bsWvMKBzUxBwMOkvnJkktCranatgURQhqkgQM1toEJo5jQjKIATzl_bCblrp5wSarJlvC6E3z36XZ-f4t0WzbMWNtv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