<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/113692>113692</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang crashes on x86_64-linux-gnu: cannot pop empty stack
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          bi6c
      </td>
    </tr>
</table>

<pre>
    Compiler Explorer: https://godbolt.org/z/5xWqKh1q3

```console
fatal error: error in backend: Cannot pop empty stack!
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-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 -fsanitize=undefined -fsanitize=address -O0 <source>
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '<source>'.
4.      Running pass 'X86 FP Stackifier' on function '@add_sf'
 #0 0x000000000396cd78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x396cd78)
 #1 0x000000000396aee4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x396aee4)
 #2 0x00000000038bbd33 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x38bbd33)
 #3 0x000000000396292e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x396292e)
 #4 0x0000000000ce81db LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x00000000038c5d43 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x38c5d43)
 #6 0x00000000038c5ea8 (/opt/compiler-explorer/clang-trunk/bin/clang+0x38c5ea8)
 #7 0x00000000023e45cf (anonymous namespace)::FPS::popStackAfter(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) X86FloatingPoint.cpp:0:0
 #8 0x00000000023ea764 (anonymous namespace)::FPS::processBasicBlock(llvm::MachineFunction&, llvm::MachineBasicBlock&) (.isra.0) X86FloatingPoint.cpp:0:0
 #9 0x00000000023eadfe (anonymous namespace)::FPS::runOnMachineFunction(llvm::MachineFunction&) (.part.0) X86FloatingPoint.cpp:0:0
#10 0x00000000023eb68b (anonymous namespace)::FPS::runOnMachineFunction(llvm::MachineFunction&) X86FloatingPoint.cpp:0:0
#11 0x0000000002d9405b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#12 0x00000000032e1a02 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x32e1a02)
#13 0x00000000032e1c91 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x32e1c91)
#14 0x00000000032e3636 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x32e3636)
#15 0x0000000003c0a2b5 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-trunk/bin/clang+0x3c0a2b5)
#16 0x00000000042b4174 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x42b4174)
#17 0x00000000062adb8c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x62adb8c)
#18 0x00000000042b4895 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x42b4895)
#19 0x000000000457cdc1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x457cdc1)
#20 0x00000000044fc85b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x44fc85b)
#21 0x0000000004661333 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4661333)
#22 0x0000000000cea38c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcea38c)
#23 0x0000000000ce2ded ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#24 0x00000000042fcea9 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
#25 0x00000000038bbc33 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x38bbc33)
#26 0x00000000042fd0c9 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
#27 0x00000000042c427d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x42c427d)
#28 0x00000000042c527d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x42c527d)
#29 0x00000000042ceccc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x42ceccc)
#30 0x0000000000ce70e1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xce70e1)
#31 0x0000000000bb9a54 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xbb9a54)
#32 0x000072f306e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#33 0x000072f306e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#34 0x0000000000ce288e _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xce288e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```
Code:
```c
#include <stdio.h>

float add_sf (float *p, float *q) {
    float f1 = *p;
    float f2 = *q;
    __asm__(" " : "+f" (f1), "+f" (f2));
    printf("float: %f + %f = %f\n", f1, f2, f1 + f2);
 return f1 + f2;
}

int main() {
    float num1 = 12.345;
 float num2 = 67.890;

    add_sf(&num1, &num2);

    return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWk1z2zjS_jX0BSUVBX6IPPggy9Y7mTepuGLv7NxUINiUsCEBBgAdeX79FgBSImg58Y6VvWwqSih8dD94utHdIESUYjsOcB0kN0Fye0U6vRfyumApvSpE-Xy9Fk3LapDo7tDWQoIMohXaa92qIFoFeBPgzU6Uhaj1XMhdgDd_BXiTHP757f_3i29REN4G4ar_Nw3dXyq4EjW41opoUiOQUljJ9gExjgpCvwIvTduacC40akWLoGn1M1Ka0K8BXjgJ9x_vVg93SHVFwzQiqOh2SEIrpEZaTKEyve-KORVNgDd1_TT8N2ul-BdQHeANU6oDFeANIrxEjNO6KwHpPSAqidpbYFoSCgFeo1ZCKwUFpaBESnTSNZuZRClBGdFQItlxpKhkrZ47yA9mAajsmtYgs03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