llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.39k stars 12.15k forks source link

Crash when using -gnu target & async SEH #117981

Open timoh-ba opened 3 days ago

timoh-ba commented 3 days ago

Problem Description

When trying to use -target x86_64-pc-windows-gnu and SEH with -fasync-exceptions (/EAh), clang crashes. From the source code it seems like this is unsupported - if this is really unsupported please tell me. Even if not I don't think clang should crash when someone still tries to use it.

Everything works if I don't pass -Xclang -fasync-exceptions to clang.

Repro Steps

Source code, compiled with: clang a.cpp -Xclang -exception-model=seh -Xclang -x86-asm-syntax=intel -Xclang -funwind-tables=2 -Xclang -fcxx-exceptions -Xclang -fexceptions -Xclang -fasync-exceptions -target x86_64-pc-windows-gnu -S

void callMe2(void*);

class A {
public:
    A() {}
    __attribute__((always_inline)) ~A() {
        callMe2(__builtin_alloca(4));
    }
};
A callMe();

int* global1;
int global2;

int doSth() {
    A myA;
    global2 = *global1;
    return 0;
}

Stack trace:

clang: /home/user/llvm-project/llvm/include/llvm/IR/BasicBlock.h:105: unsigned int llvm::BasicBlock::getNumber() const: Assertion `getParent() && "only basic blocks in functions have valid numbers"' failed.
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: build/bin/clang a.cpp -Xclang -exception-model=seh -Xclang -x86-asm-syntax=intel -Xclang -funwind-tables=2 -Xclang -fcxx-exceptions -Xclang -fexceptions -Xclang -fasync-exceptions -target x86_64-pc-windows-gnu -S
1.      <eof> parser at end of file
2.      Optimizer
3.      Running pass "verify" on module "a.cpp"
 #0 0x0000aaaabddd38c4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/user/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:11
 #1 0x0000aaaabddd3d8c PrintStackTraceSignalHandler(void*) /home/user/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x0000aaaabddd2010 llvm::sys::RunSignalHandlers() /home/user/llvm-project/llvm/lib/Support/Signals.cpp:105:5
 #3 0x0000aaaabddd30e0 llvm::sys::CleanupOnSignal(unsigned long) /home/user/llvm-project/llvm/lib/Support/Unix/Signals.inc:368:1
 #4 0x0000aaaabdcef398 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/user/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:71:7
 #5 0x0000aaaabdcef79c CrashRecoverySignalHandler(int) /home/user/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:390:5
 #6 0x0000ffff9e43b7bc (linux-vdso.so.1+0x7bc)
 #7 0x0000ffff9df90a50 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #8 0x0000ffff9df4a72c raise ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x0000ffff9df3747c abort ./stdlib/abort.c:81:7
#10 0x0000ffff9df441a4 __assert_fail_base ./assert/assert.c:89:7
#11 0x0000ffff9df4420c (/lib/aarch64-linux-gnu/libc.so.6+0x3420c)
#12 0x0000aaaabbd4a628 llvm::BasicBlock::getNumber() const /home/user/llvm-project/llvm/include/llvm/IR/BasicBlock.h:0:5
#13 0x0000aaaabd4a94f4 llvm::GraphTraits<llvm::BasicBlock*>::getNumber(llvm::BasicBlock const*) /home/user/llvm-project/llvm/include/llvm/IR/CFG.h:308:53
#14 0x0000aaaabd4a8a30 llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::getNodeInfo(llvm::BasicBlock*) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:132:63
#15 0x0000aaaabd4a8808 unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::runDFS<false, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int, llvm::DenseMap<llvm::BasicBlock*, unsigned int, llvm::DenseMapInfo<llvm::BasicBlock*, void>, llvm::detail::DenseMapPair<llvm::BasicBlock*, unsigned int>> const*) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:204:13
#16 0x0000aaaabd4a7c84 void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::doFullDFSWalk<bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:552:7
#17 0x0000aaaabd49ec38 llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::CalculateFromScratch(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::BatchUpdateInfo*) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:579:10
#18 0x0000aaaabd49b84c void llvm::DomTreeBuilder::Calculate<llvm::DominatorTreeBase<llvm::BasicBlock, false>>(llvm::DominatorTreeBase<llvm::BasicBlock, false>&) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:1554:1
#19 0x0000aaaabd49b824 llvm::DominatorTreeBase<llvm::BasicBlock, false>::recalculate(llvm::Function&) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTree.h:845:3
#20 0x0000aaaabd64d58c (anonymous namespace)::Verifier::verify(llvm::Function const&) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:412:7
#21 0x0000aaaabd64d91c llvm::verifyModule(llvm::Module const&, llvm::raw_ostream*, bool*) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:7205:18
#22 0x0000aaaabd64f440 llvm::VerifierAnalysis::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:7621:16
#23 0x0000aaaac01dbe0c llvm::detail::AnalysisPassModel<llvm::Module, llvm::VerifierAnalysis, llvm::AnalysisManager<llvm::Module>::Invalidator>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:320:14
#24 0x0000aaaabd6015f8 llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*, llvm::Module&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:156:35
#25 0x0000aaaabd6792fc llvm::VerifierAnalysis::Result& llvm::AnalysisManager<llvm::Module>::getResult<llvm::VerifierAnalysis>(llvm::Module&) /home/user/llvm-project/llvm/include/llvm/IR/PassManager.h:408:21
#26 0x0000aaaabd64f4d8 llvm::VerifierPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:7631:17
#27 0x0000aaaabee59188 llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
#28 0x0000aaaabd5fe0f4 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
#29 0x0000aaaabee46d08 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) /home/user/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1158:9
#30 0x0000aaaabee41398 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) /home/user/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1223:3
#31 0x0000aaaabee409d4 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*) /home/user/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1387:13
#32 0x0000aaaabee6da94 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/user/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:354:3
#33 0x0000aaaac2bf47d8 clang::ParseAST(clang::Sema&, bool, bool) /home/user/llvm-project/clang/lib/Parse/ParseAST.cpp:191:12
#34 0x0000aaaabf47f86c clang::ASTFrontendAction::ExecuteAction() /home/user/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1193:1
#35 0x0000aaaabee71368 clang::CodeGenAction::ExecuteAction() /home/user/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1143:5
#36 0x0000aaaabf47f2d4 clang::FrontendAction::Execute() /home/user/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1077:8
#37 0x0000aaaabf39ee80 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/user/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1060:33
#38 0x0000aaaabf665890 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/user/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:296:8
#39 0x0000aaaabbb5cf90 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/user/llvm-project/clang/tools/driver/cc1_main.cpp:285:15
#40 0x0000aaaabbb4ec94 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/user/llvm-project/clang/tools/driver/driver.cpp:217:5
#41 0x0000aaaabbb4f6cc clang_main(int, char**, llvm::ToolContext const&)::$_0::operator()(llvm::SmallVectorImpl<char const*>&) const /home/user/llvm-project/clang/tools/driver/driver.cpp:357:7
#42 0x0000aaaabbb4f6a0 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::$_0>(long, llvm::SmallVectorImpl<char const*>&) /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#43 0x0000aaaabf23cf08 llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::operator()(llvm::SmallVectorImpl<char const*>&) const /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#44 0x0000aaaabf2394a0 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1::operator()() const /home/user/llvm-project/clang/lib/Driver/Job.cpp:439:34
#45 0x0000aaaabf23946c 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::$_1>(long) /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#46 0x0000aaaabc9b2c10 llvm::function_ref<void ()>::operator()() const /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#47 0x0000aaaabdcef1b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/user/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:426:3
#48 0x0000aaaabf238da8 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /home/user/llvm-project/clang/lib/Driver/Job.cpp:439:7
#49 0x0000aaaabf1d4cb0 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /home/user/llvm-project/clang/lib/Driver/Compilation.cpp:199:15
#50 0x0000aaaabf1d4e80 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /home/user/llvm-project/clang/lib/Driver/Compilation.cpp:253:13
#51 0x0000aaaabf1ec7f4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /home/user/llvm-project/clang/lib/Driver/Driver.cpp:1972:7
#52 0x0000aaaabbb4e848 clang_main(int, char**, llvm::ToolContext const&) /home/user/llvm-project/clang/tools/driver/driver.cpp:393:21
#53 0x0000aaaabbb8401c main /home/user/llvm-project/build/tools/clang/tools/driver/clang-driver.cpp:17:10
#54 0x0000ffff9df37740 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#55 0x0000ffff9df37818 call_init ./csu/../csu/libc-start.c:128:20
#56 0x0000ffff9df37818 __libc_start_main ./csu/../csu/libc-start.c:347:5
#57 0x0000aaaabbb4d7f0 _start (build/bin/clang+0x664d7f0)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 20.0.0git (https://github.com/llvm/llvm-project f77101ea7913ab6a6b28ad03c152c615a89900f6)
Target: x86_64-pc-windows-gnu
Thread model: posix
InstalledDir: /home/user/llvm-project/build/bin
Build config: +unoptimized, +assertions
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/a-fbd841.cpp
clang: note: diagnostic msg: /tmp/a-fbd841.sh
clang: note: diagnostic msg: 

********************

Command:

# Crash reproducer for clang version 20.0.0git (https://github.com/llvm/llvm-project f77101ea7913ab6a6b28ad03c152c615a89900f6)
# Driver args: "a.cpp" "-Xclang" "-exception-model=seh" "-Xclang" "-x86-asm-syntax=intel" "-Xclang" "-funwind-tables=2" "-Xclang" "-fcxx-exceptions" "-Xclang" "-fexceptions" "-Xclang" "-fasync-exceptions" "-target" "x86_64-pc-windows-gnu" "-S"
# Original command:  "/home/user/llvm-project/build/bin/clang-20" "-cc1" "-triple" "x86_64-pc-windows-gnu" "-S" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "a.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-fno-sized-deallocation" "-fno-use-init-array" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/user/llvm-project" "-fcoverage-compilation-dir=/home/user/llvm-project" "-resource-dir" "/home/user/llvm-project/build/lib/clang/20" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++/backward" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++/" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++//x86_64-w64-mingw32" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++//backward" "-internal-isystem" "/home/user/llvm-project/build/include/c++/" "-internal-isystem" "/home/user/llvm-project/build/include/c++//x86_64-w64-mingw32" "-internal-isystem" "/home/user/llvm-project/build/include/c++//backward" "-internal-isystem" "include/c++" "-internal-isystem" "include/c++/x86_64-w64-mingw32" "-internal-isystem" "include/c++/backward" "-internal-isystem" "include/g++-v0.0.0" "-internal-isystem" "include/g++-v0.0.0/x86_64-w64-mingw32" "-internal-isystem" "include/g++-v0.0.0/backward" "-internal-isystem" "include/g++-v0.0" "-internal-isystem" "include/g++-v0.0/x86_64-w64-mingw32" "-internal-isystem" "include/g++-v0.0/backward" "-internal-isystem" "include/g++-v0" "-internal-isystem" "include/g++-v0/x86_64-w64-mingw32" "-internal-isystem" "include/g++-v0/backward" "-internal-isystem" "/home/user/llvm-project/build/lib/clang/20/include" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/usr/include" "-fdeprecated-macro" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-exception-model=seh" "-x86-asm-syntax=intel" "-funwind-tables=2" "-fcxx-exceptions" "-fexceptions" "-fasync-exceptions" "-faddrsig" "-o" "a.s" "-x" "c++" "a.cpp"
 "/home/user/llvm-project/build/bin/clang-20" "-cc1" "-triple" "x86_64-pc-windows-gnu" "-S" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "a.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-fno-sized-deallocation" "-fno-use-init-array" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/user/llvm-project" "-fcoverage-compilation-dir=/home/user/llvm-project" "-fdeprecated-macro" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-exception-model=seh" "-x86-asm-syntax=intel" "-funwind-tables=2" "-fcxx-exceptions" "-fexceptions" "-fasync-exceptions" "-faddrsig" "-x" "c++" "a-fbd841.cpp"
llvmbot commented 3 days ago

@llvm/issue-subscribers-clang-codegen

Author: None (timoh-ba)

# Problem Description When trying to use `-target x86_64-pc-windows-gnu` and SEH with `-fasync-exceptions` (/EAh), clang crashes. From the source code it seems like this is unsupported - if this is really unsupported please tell me. Even if not I don't think clang should crash when someone still tries to use it. Everything works if I don't pass `-Xclang -fasync-exceptions` to clang. # Repro Steps Source code, compiled with: `clang a.cpp -Xclang -exception-model=seh -Xclang -x86-asm-syntax=intel -Xclang -funwind-tables=2 -Xclang -fcxx-exceptions -Xclang -fexceptions -Xclang -fasync-exceptions -target x86_64-pc-windows-gnu -S` ```C++ void callMe2(void*); class A { public: A() {} __attribute__((always_inline)) ~A() { callMe2(__builtin_alloca(4)); } }; A callMe(); int* global1; int global2; int doSth() { A myA; global2 = *global1; return 0; } ``` Stack trace: ``` clang: /home/user/llvm-project/llvm/include/llvm/IR/BasicBlock.h:105: unsigned int llvm::BasicBlock::getNumber() const: Assertion `getParent() && "only basic blocks in functions have valid numbers"' failed. 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: build/bin/clang a.cpp -Xclang -exception-model=seh -Xclang -x86-asm-syntax=intel -Xclang -funwind-tables=2 -Xclang -fcxx-exceptions -Xclang -fexceptions -Xclang -fasync-exceptions -target x86_64-pc-windows-gnu -S 1. <eof> parser at end of file 2. Optimizer 3. Running pass "verify" on module "a.cpp" #0 0x0000aaaabddd38c4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/user/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:11 #1 0x0000aaaabddd3d8c PrintStackTraceSignalHandler(void*) /home/user/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1 #2 0x0000aaaabddd2010 llvm::sys::RunSignalHandlers() /home/user/llvm-project/llvm/lib/Support/Signals.cpp:105:5 #3 0x0000aaaabddd30e0 llvm::sys::CleanupOnSignal(unsigned long) /home/user/llvm-project/llvm/lib/Support/Unix/Signals.inc:368:1 #4 0x0000aaaabdcef398 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/user/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:71:7 #5 0x0000aaaabdcef79c CrashRecoverySignalHandler(int) /home/user/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:390:5 #6 0x0000ffff9e43b7bc (linux-vdso.so.1+0x7bc) #7 0x0000ffff9df90a50 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76 #8 0x0000ffff9df4a72c raise ./signal/../sysdeps/posix/raise.c:27:6 #9 0x0000ffff9df3747c abort ./stdlib/abort.c:81:7 #10 0x0000ffff9df441a4 __assert_fail_base ./assert/assert.c:89:7 #11 0x0000ffff9df4420c (/lib/aarch64-linux-gnu/libc.so.6+0x3420c) #12 0x0000aaaabbd4a628 llvm::BasicBlock::getNumber() const /home/user/llvm-project/llvm/include/llvm/IR/BasicBlock.h:0:5 #13 0x0000aaaabd4a94f4 llvm::GraphTraits<llvm::BasicBlock*>::getNumber(llvm::BasicBlock const*) /home/user/llvm-project/llvm/include/llvm/IR/CFG.h:308:53 #14 0x0000aaaabd4a8a30 llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::getNodeInfo(llvm::BasicBlock*) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:132:63 #15 0x0000aaaabd4a8808 unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::runDFS<false, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::BasicBlock*, unsigned int, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*), unsigned int, llvm::DenseMap<llvm::BasicBlock*, unsigned int, llvm::DenseMapInfo<llvm::BasicBlock*, void>, llvm::detail::DenseMapPair<llvm::BasicBlock*, unsigned int>> const*) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:204:13 #16 0x0000aaaabd4a7c84 void llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::doFullDFSWalk<bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)>(llvm::DominatorTreeBase<llvm::BasicBlock, false> const&, bool (*)(llvm::BasicBlock*, llvm::BasicBlock*)) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:552:7 #17 0x0000aaaabd49ec38 llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::CalculateFromScratch(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false>>::BatchUpdateInfo*) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:579:10 #18 0x0000aaaabd49b84c void llvm::DomTreeBuilder::Calculate<llvm::DominatorTreeBase<llvm::BasicBlock, false>>(llvm::DominatorTreeBase<llvm::BasicBlock, false>&) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:1554:1 #19 0x0000aaaabd49b824 llvm::DominatorTreeBase<llvm::BasicBlock, false>::recalculate(llvm::Function&) /home/user/llvm-project/llvm/include/llvm/Support/GenericDomTree.h:845:3 #20 0x0000aaaabd64d58c (anonymous namespace)::Verifier::verify(llvm::Function const&) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:412:7 #21 0x0000aaaabd64d91c llvm::verifyModule(llvm::Module const&, llvm::raw_ostream*, bool*) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:7205:18 #22 0x0000aaaabd64f440 llvm::VerifierAnalysis::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:7621:16 #23 0x0000aaaac01dbe0c llvm::detail::AnalysisPassModel<llvm::Module, llvm::VerifierAnalysis, llvm::AnalysisManager<llvm::Module>::Invalidator>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:320:14 #24 0x0000aaaabd6015f8 llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*, llvm::Module&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:156:35 #25 0x0000aaaabd6792fc llvm::VerifierAnalysis::Result& llvm::AnalysisManager<llvm::Module>::getResult<llvm::VerifierAnalysis>(llvm::Module&) /home/user/llvm-project/llvm/include/llvm/IR/PassManager.h:408:21 #26 0x0000aaaabd64f4d8 llvm::VerifierPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/lib/IR/Verifier.cpp:7631:17 #27 0x0000aaaabee59188 llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5 #28 0x0000aaaabd5fe0f4 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/user/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38 #29 0x0000aaaabee46d08 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) /home/user/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1158:9 #30 0x0000aaaabee41398 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) /home/user/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1223:3 #31 0x0000aaaabee409d4 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*) /home/user/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1387:13 #32 0x0000aaaabee6da94 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/user/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:354:3 #33 0x0000aaaac2bf47d8 clang::ParseAST(clang::Sema&, bool, bool) /home/user/llvm-project/clang/lib/Parse/ParseAST.cpp:191:12 #34 0x0000aaaabf47f86c clang::ASTFrontendAction::ExecuteAction() /home/user/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1193:1 #35 0x0000aaaabee71368 clang::CodeGenAction::ExecuteAction() /home/user/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1143:5 #36 0x0000aaaabf47f2d4 clang::FrontendAction::Execute() /home/user/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1077:8 #37 0x0000aaaabf39ee80 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/user/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1060:33 #38 0x0000aaaabf665890 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/user/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:296:8 #39 0x0000aaaabbb5cf90 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/user/llvm-project/clang/tools/driver/cc1_main.cpp:285:15 #40 0x0000aaaabbb4ec94 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/user/llvm-project/clang/tools/driver/driver.cpp:217:5 #41 0x0000aaaabbb4f6cc clang_main(int, char**, llvm::ToolContext const&)::$_0::operator()(llvm::SmallVectorImpl<char const*>&) const /home/user/llvm-project/clang/tools/driver/driver.cpp:357:7 #42 0x0000aaaabbb4f6a0 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::$_0>(long, llvm::SmallVectorImpl<char const*>&) /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5 #43 0x0000aaaabf23cf08 llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::operator()(llvm::SmallVectorImpl<char const*>&) const /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5 #44 0x0000aaaabf2394a0 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1::operator()() const /home/user/llvm-project/clang/lib/Driver/Job.cpp:439:34 #45 0x0000aaaabf23946c 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::$_1>(long) /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5 #46 0x0000aaaabc9b2c10 llvm::function_ref<void ()>::operator()() const /home/user/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5 #47 0x0000aaaabdcef1b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/user/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:426:3 #48 0x0000aaaabf238da8 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /home/user/llvm-project/clang/lib/Driver/Job.cpp:439:7 #49 0x0000aaaabf1d4cb0 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /home/user/llvm-project/clang/lib/Driver/Compilation.cpp:199:15 #50 0x0000aaaabf1d4e80 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /home/user/llvm-project/clang/lib/Driver/Compilation.cpp:253:13 #51 0x0000aaaabf1ec7f4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /home/user/llvm-project/clang/lib/Driver/Driver.cpp:1972:7 #52 0x0000aaaabbb4e848 clang_main(int, char**, llvm::ToolContext const&) /home/user/llvm-project/clang/tools/driver/driver.cpp:393:21 #53 0x0000aaaabbb8401c main /home/user/llvm-project/build/tools/clang/tools/driver/clang-driver.cpp:17:10 #54 0x0000ffff9df37740 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3 #55 0x0000ffff9df37818 call_init ./csu/../csu/libc-start.c:128:20 #56 0x0000ffff9df37818 __libc_start_main ./csu/../csu/libc-start.c:347:5 #57 0x0000aaaabbb4d7f0 _start (build/bin/clang+0x664d7f0) clang: error: clang frontend command failed with exit code 134 (use -v to see invocation) clang version 20.0.0git (https://github.com/llvm/llvm-project f77101ea7913ab6a6b28ad03c152c615a89900f6) Target: x86_64-pc-windows-gnu Thread model: posix InstalledDir: /home/user/llvm-project/build/bin Build config: +unoptimized, +assertions 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/a-fbd841.cpp clang: note: diagnostic msg: /tmp/a-fbd841.sh clang: note: diagnostic msg: ******************** ``` Command: ```bash # Crash reproducer for clang version 20.0.0git (https://github.com/llvm/llvm-project f77101ea7913ab6a6b28ad03c152c615a89900f6) # Driver args: "a.cpp" "-Xclang" "-exception-model=seh" "-Xclang" "-x86-asm-syntax=intel" "-Xclang" "-funwind-tables=2" "-Xclang" "-fcxx-exceptions" "-Xclang" "-fexceptions" "-Xclang" "-fasync-exceptions" "-target" "x86_64-pc-windows-gnu" "-S" # Original command: "/home/user/llvm-project/build/bin/clang-20" "-cc1" "-triple" "x86_64-pc-windows-gnu" "-S" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "a.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-fno-sized-deallocation" "-fno-use-init-array" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/user/llvm-project" "-fcoverage-compilation-dir=/home/user/llvm-project" "-resource-dir" "/home/user/llvm-project/build/lib/clang/20" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++/backward" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++/" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++//x86_64-w64-mingw32" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include/c++//backward" "-internal-isystem" "/home/user/llvm-project/build/include/c++/" "-internal-isystem" "/home/user/llvm-project/build/include/c++//x86_64-w64-mingw32" "-internal-isystem" "/home/user/llvm-project/build/include/c++//backward" "-internal-isystem" "include/c++" "-internal-isystem" "include/c++/x86_64-w64-mingw32" "-internal-isystem" "include/c++/backward" "-internal-isystem" "include/g++-v0.0.0" "-internal-isystem" "include/g++-v0.0.0/x86_64-w64-mingw32" "-internal-isystem" "include/g++-v0.0.0/backward" "-internal-isystem" "include/g++-v0.0" "-internal-isystem" "include/g++-v0.0/x86_64-w64-mingw32" "-internal-isystem" "include/g++-v0.0/backward" "-internal-isystem" "include/g++-v0" "-internal-isystem" "include/g++-v0/x86_64-w64-mingw32" "-internal-isystem" "include/g++-v0/backward" "-internal-isystem" "/home/user/llvm-project/build/lib/clang/20/include" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/include" "-internal-isystem" "/home/user/llvm-project/build/x86_64-w64-mingw32/usr/include" "-fdeprecated-macro" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-exception-model=seh" "-x86-asm-syntax=intel" "-funwind-tables=2" "-fcxx-exceptions" "-fexceptions" "-fasync-exceptions" "-faddrsig" "-o" "a.s" "-x" "c++" "a.cpp" "/home/user/llvm-project/build/bin/clang-20" "-cc1" "-triple" "x86_64-pc-windows-gnu" "-S" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "a.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-mms-bitfields" "-funwind-tables=2" "-fno-sized-deallocation" "-fno-use-init-array" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/user/llvm-project" "-fcoverage-compilation-dir=/home/user/llvm-project" "-fdeprecated-macro" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions" "-exception-model=seh" "-fcolor-diagnostics" "-exception-model=seh" "-x86-asm-syntax=intel" "-funwind-tables=2" "-fcxx-exceptions" "-fexceptions" "-fasync-exceptions" "-faddrsig" "-x" "c++" "a-fbd841.cpp" ```