Skip to content

clang crashes on x86_64-linux-gnu #113211

@bi6c

Description

@bi6c

Compiler Explorer: https://godbolt.org/z/GYhd9EeG4

fatal error: error in backend: Stack empty??
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-19.1.0/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-13.2.0 -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 '@____strtold_l_internal'
 #0 0x00000000036fdb08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x36fdb08)
 #1 0x00000000036fbc74 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x36fbc74)
 #2 0x0000000003648113 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3648113)
 #3 0x00000000036f344e llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x36f344e)
 #4 0x0000000000c855c6 (/opt/compiler-explorer/clang-19.1.0/bin/clang+0xc855c6)
 #5 0x0000000003652143 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3652143)
 #6 0x00000000036522a8 (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x36522a8)
 #7 0x00000000022f8ca7 (anonymous namespace)::FPS::processBasicBlock(llvm::MachineFunction&, llvm::MachineBasicBlock&) (.isra.0) X86FloatingPoint.cpp:0:0
 #8 0x00000000022f926e (anonymous namespace)::FPS::runOnMachineFunction(llvm::MachineFunction&) (.part.0) X86FloatingPoint.cpp:0:0
 #9 0x00000000022f9abb (anonymous namespace)::FPS::runOnMachineFunction(llvm::MachineFunction&) X86FloatingPoint.cpp:0:0
#10 0x0000000002b5181b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#11 0x000000000309ca72 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x309ca72)
#12 0x000000000309cbf1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x309cbf1)
#13 0x000000000309e8a0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x309e8a0)
#14 0x0000000003996531 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-19.1.0/bin/clang+0x3996531)
#15 0x0000000003fce094 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3fce094)
#16 0x0000000005f1899c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x5f1899c)
#17 0x0000000003fce825 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3fce825)
#18 0x0000000004274201 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x4274201)
#19 0x00000000041f699b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x41f699b)
#20 0x000000000435a843 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x435a843)
#21 0x0000000000c874dc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0xc874dc)
#22 0x0000000000c8146d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#23 0x0000000004017309 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
#24 0x0000000003648013 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3648013)
#25 0x0000000004017529 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
#26 0x0000000003fdd947 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3fdd947)
#27 0x0000000003fde2fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3fde2fd)
#28 0x0000000003fe7d4c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0x3fe7d4c)
#29 0x0000000000c847f1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-19.1.0/bin/clang+0xc847f1)
#30 0x0000000000b5c2d4 main (/opt/compiler-explorer/clang-19.1.0/bin/clang+0xb5c2d4)
#31 0x000070d58e029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#32 0x000070d58e029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#33 0x0000000000c80f0e _start (/opt/compiler-explorer/clang-19.1.0/bin/clang+0xc80f0e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
#include <stdio.h>
#include <stdlib.h>

long double ____strtold_l_internal___x;

void ____strtold_l_internal() {
    __asm__("" : "+fm"(____strtold_l_internal___x));
    printf("Variable ____strtold_l_internal___x: %Lf\n", ____strtold_l_internal___x);
}

int main() {
    ____strtold_l_internal___x = 1.41421;
    ____strtold_l_internal();
    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions