<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102053>102053</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
fatal error: error in backend: failed to perform tail call elimination on a call site marked musttail on arm32 darwin
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Un1q32
</td>
</tr>
</table>
<pre>
used test case from #63214
```c++
void name(int *params, int *program, int r, int g, int b, int a) {
auto fn = (void (*)(int *, int *, int, int, int, int))1;
[[clang::musttail]] return fn(params, program, r, g, b, a);
}
```
compile with:
```sh
clang++ -target armv7-apple-darwin test.cpp -c # crashes with all 32 bit arm architectures except armv4t and armv5
```
output:
```console
fatal error: error in backend: failed to perform tail call elimination on a call site marked musttail
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++ -target armv7-apple-darwin test.cpp -c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'test.cpp'.
4. Running pass 'ARM Instruction Selection' on function '@_Z4namePiS_iiii'
#0 0x0000000005dd91f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm19/bin/clang-19+0x5dd91f8)
#1 0x0000000005dd6fee llvm::sys::RunSignalHandlers() (/opt/llvm19/bin/clang-19+0x5dd6fee)
#2 0x0000000005d4d59e (/opt/llvm19/bin/clang-19+0x5d4d59e)
#3 0x0000000005d4d55b (/opt/llvm19/bin/clang-19+0x5d4d55b)
#4 0x0000000005dd39d7 llvm::sys::Process::Exit(int, bool) (/opt/llvm19/bin/clang-19+0x5dd39d7)
#5 0x0000000003db0ac3 (/opt/llvm19/bin/clang-19+0x3db0ac3)
#6 0x0000000005d537d9 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/llvm19/bin/clang-19+0x5d537d9)
#7 0x0000000005d536c6 (/opt/llvm19/bin/clang-19+0x5d536c6)
#8 0x00000000044ce474 (/opt/llvm19/bin/clang-19+0x44ce474)
#9 0x0000000006d91d6a llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&) const (/opt/llvm19/bin/clang-19+0x6d91d6a)
#10 0x0000000006daf6a6 llvm::SelectionDAGBuilder::lowerInvokable(llvm::TargetLowering::CallLoweringInfo&, llvm::BasicBlock const*) (/opt/llvm19/bin/clang-19+0x6daf6a6)
#11 0x0000000006d996ff llvm::SelectionDAGBuilder::LowerCallTo(llvm::CallBase const&, llvm::SDValue, bool, bool, llvm::BasicBlock const*, llvm::TargetLowering::PtrAuthInfo const*) (/opt/llvm19/bin/clang-19+0x6d996ff)
#12 0x0000000006d85950 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/opt/llvm19/bin/clang-19+0x6d85950)
#13 0x0000000006d7b106 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/llvm19/bin/clang-19+0x6d7b106)
#14 0x0000000006e16343 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, bool&) (/opt/llvm19/bin/clang-19+0x6e16343)
#15 0x0000000006e15bdb llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/llvm19/bin/clang-19+0x6e15bdb)
#16 0x0000000006e13de2 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/llvm19/bin/clang-19+0x6e13de2)
#17 0x00000000045a2251 (/opt/llvm19/bin/clang-19+0x45a2251)
#18 0x0000000006e1294e llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/llvm19/bin/clang-19+0x6e1294e)
#19 0x00000000054c97b4 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/llvm19/bin/clang-19+0x54c97b4)
#20 0x00000000058e9ba2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/llvm19/bin/clang-19+0x58e9ba2)
#21 0x00000000058f0a13 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/llvm19/bin/clang-19+0x58f0a13)
#22 0x00000000058ea896 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/llvm19/bin/clang-19+0x58ea896)
#23 0x00000000064ac252 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/llvm19/bin/clang-19+0x64ac252)
#24 0x00000000064cd0c5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/llvm19/bin/clang-19+0x64cd0c5)
#25 0x0000000007e368f9 clang::ParseAST(clang::Sema&, bool, bool) (/opt/llvm19/bin/clang-19+0x7e368f9)
#26 0x00000000068e89d6 clang::FrontendAction::Execute() (/opt/llvm19/bin/clang-19+0x68e89d6)
#27 0x0000000006859ba4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/llvm19/bin/clang-19+0x6859ba4)
#28 0x00000000069b3b7e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/llvm19/bin/clang-19+0x69b3b7e)
#29 0x0000000003db0739 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/llvm19/bin/clang-19+0x3db0739)
#30 0x0000000003dad991 (/opt/llvm19/bin/clang-19+0x3dad991)
#31 0x00000000066a30c9 (/opt/llvm19/bin/clang-19+0x66a30c9)
#32 0x0000000005d4d53c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/llvm19/bin/clang-19+0x5d4d53c)
#33 0x00000000066a2b06 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/opt/llvm19/bin/clang-19+0x66a2b06)
#34 0x0000000006661367 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/llvm19/bin/clang-19+0x6661367)
#35 0x000000000666180e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/llvm19/bin/clang-19+0x666180e)
#36 0x000000000667febf clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/llvm19/bin/clang-19+0x667febf)
#37 0x0000000003dad06b clang_main(int, char**, llvm::ToolContext const&) (/opt/llvm19/bin/clang-19+0x3dad06b)
#38 0x0000000003dbc0e7 main (/opt/llvm19/bin/clang-19+0x3dbc0e7)
#39 0x00007f8fed239088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#40 0x00007f8fed23914b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#41 0x0000000003dab525 _start (/opt/llvm19/bin/clang-19+0x3dab525)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.1.0-rc2
Target: armv7-apple-darwin
Thread model: posix
InstalledDir: /opt/llvm19/bin
clang++: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/test-c84746.cpp
clang++: note: diagnostic msg: /tmp/test-c84746.sh
clang++: note: diagnostic msg:
********************
```
[test-c84746.cpp](https://github.com/user-attachments/files/16502302/test-c84746.cpp.txt)
[test-c84746.sh](https://github.com/user-attachments/files/16502303/test-c84746.sh.txt)
</pre>
<img width="1px" height="1px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