<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69217>69217</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: fatal error: error in backend: register rbp is allocatable: function has no frame pointer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
connglli
</td>
</tr>
</table>
<pre>
Compiler explorer: https://godbolt.org/z/9Yq36Wdov.
The following program `small.c` triggers a crash in clang-18:
``` sh
% cat small.c
register long a asm("rbp");
long foo() {
return a * a;
}
% clang -O1 small.c
fatal error: error in backend: register rbp is allocatable: function has no frame pointer
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 -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O1 <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 '@foo'
#0 0x000000000372f498 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372f498)
#1 0x000000000372d15c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372d15c)
#2 0x0000000003675fe6 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3675fe6)
#3 0x00000000037244ae llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x37244ae)
#4 0x0000000000bed7da LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#5 0x0000000003680983 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3680983)
#6 0x00000000023a9aaf llvm::X86TargetLowering::getRegisterByName(char const*, llvm::LLT, llvm::MachineFunction const&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x23a9aaf)
#7 0x000000000482a9de llvm::SelectionDAGISel::Select_READ_REGISTER(llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x482a9de)
#8 0x000000000482dd33 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x482dd33)
#9 0x0000000002318899 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#10 0x0000000004828c5f llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4828c5f)
#11 0x0000000004836097 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4836097)
#12 0x0000000004839618 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4839618)
#13 0x000000000483b312 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#14 0x000000000232257c (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#15 0x0000000002b04411 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x00000000030b2af9 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x30b2af9)
#17 0x00000000030b2d31 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x30b2d31)
#18 0x00000000030b3552 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x30b3552)
#19 0x00000000039a3c02 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) BackendUtil.cpp:0:0
#20 0x00000000039a40a9 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>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x39a40a9)
#21 0x000000000499c34f clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x499c34f)
#22 0x0000000005ea1529 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ea1529)
#23 0x000000000499b538 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x499b538)
#24 0x00000000041fefa9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41fefa9)
#25 0x000000000418044e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x418044e)
#26 0x00000000042de12e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42de12e)
#27 0x0000000000befa56 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbefa56)
#28 0x0000000000be731a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#29 0x0000000003fdc649 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
#30 0x0000000003675f24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3675f24)
#31 0x0000000003fdcc3f 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
#32 0x0000000003fa4e05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fa4e05)
#33 0x0000000003fa586d 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+0x3fa586d)
#34 0x0000000003fad795 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fad795)
#35 0x0000000000becefc clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbecefc)
#36 0x0000000000ae7091 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xae7091)
#37 0x00007ff94969a083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#38 0x0000000000be6dfe _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbe6dfe)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
```
Clang version:
```
clang version 18.0.0 (https://github.com/llvm/llvm-project.git ab737a86993bc7bf92cbb9d51f47f8825a717333)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-assertions-trunk/bin
Compiler returned: 0
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWktz47aT_zT0BSUVCVJ8HHyQJcuZlCfjspxs9qQCwSaFHRBgANCP_fRbICmZoOXYSTTZwz-VmaEAEPj1rxv9AEG0ZpUAuPQWV95ifUFas5fqkkohKs7ZRS6Ll8uVrBvGQSF4brhUoLxwifbGNNoLlx7eeHhTySKX3Mylqjy8-V8Pb7L__iOM_6uQj3PPX3v-sv_7YQ-olJzLJyYq1ChZKVIjL_Z1TTifUy_2kVGsqkBpRBBVRO8RE4hyIqpZkNoFR9N5sd__j_R-aMELRIlBh_m6RgUV0wYU4lJUiCCiaw-nHsYqbzyMPZx54VU_tBtRStn1Z8hLhnaEFJhWCUSQh5eIHF_wkrWDyK5vwaLZt8BFURJDOAKlZEdg92Blywn9DqKwbUegKm8Q04hwLikxJOdgu8tWUMOkQHuikZCoVKQG1EgmDKh-kbvb6-X2Guk2r5lBBOVthRQ0Uhlk5FRpzOzbfE5l7eEN54-Hf2aNkv8D1Hh4w7RuQXt4g4goEBOUtwUgs4dBNRa7UYSCh1eoUdAoSUFrKJCWreqb7ZtEa0kZMVAg1QqkqWKNGSxjawj9joq2bo7a9ecI3Q3GQVTV1iCMxY08vJGNBUYHm5wdbRJveiMhWoOyLOmZUa347uFNzsShG82q4omochahWYVm0s5ImsbO25qmNXONZrUlAc1mz2k8I7qe6RdhyLMXri3PHM22aDarKJ0ZKTndEya8cP2nwOzgbI7nPpqVVHKpZgUjlZDaMKrRrBRy1tHpNn8LkBeuBh7D656ZYI5sK8jSC69RQ5QGhYhBIAokS1QyDv1APEcrWQCqQIAilo--PZwjdN8K0e0_ojXycLI52NWdbfhKBKks7gRJgWpZtBzsKAcMTgbtRSfm-z2N0Xp5M_PC6_XyBn0R2qi2X2ELHLqnYfqjSdsFIr_becmw5Twc-sh_9g__hQkuoyxFnamGSy9c6hfdP9w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