[PATCH] D97687: [SEH] Fix capture of this in lambda functions
Stephan Bergmann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 6 01:57:42 PDT 2021
sberg added a comment.
Bisecting shows that this started to break
$ cat test.cc
void f() noexcept { __try {} __finally {} }
$ clang-cl -EHs -c test.cc
clang-cl: ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CGCleanup.h:568: void clang::CodeGen::EHScopeStack::popTerminate(): Assertion `!empty() && "popping exception stack when not empty"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: ~/llvm/inst/bin/clang-cl -EHs -c test.cc
1. <eof> parser at end of file
2. test.cc:1:6: LLVM IR generation of declaration 'f'
3. test.cc:1:6: Generating code for declaration 'f'
#0 0x00007f2fd211624d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) ~/github.com/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:3
#1 0x00007f2fd2114174 llvm::sys::RunSignalHandlers() ~/github.com/llvm/llvm-project/llvm/lib/Support/Signals.cpp:71:20
#2 0x00007f2fd20368c8 HandleCrash ~/github.com/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:75:5
#3 0x00007f2fd20368c8 CrashRecoverySignalHandler(int) ~/github.com/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:388:62
#4 0x00007f2fd68f91e0 __restore_rt sigaction.c:0:0
#5 0x00007f2fd1a4b9d5 raise /usr/src/debug/glibc-2.32-37-g760e1d2878/signal/../sysdeps/unix/sysv/linux/raise.c:50:1
#6 0x00007f2fd1a348a4 abort /usr/src/debug/glibc-2.32-37-g760e1d2878/stdlib/abort.c:81:7
#7 0x00007f2fd1a34789 get_sysdep_segment_value /usr/src/debug/glibc-2.32-37-g760e1d2878/intl/loadmsgcat.c:509:8
#8 0x00007f2fd1a34789 _nl_load_domain.cold /usr/src/debug/glibc-2.32-37-g760e1d2878/intl/loadmsgcat.c:970:34
#9 0x00007f2fd1a44026 .annobin___GI___assert_fail.end assert.c:0:0
#10 0x00007f2fd5871973 (~/llvm/inst/bin/../lib/libclangCodeGen.so.13git+0x44b973)
#11 0x00007f2fd587612a (~/llvm/inst/bin/../lib/libclangCodeGen.so.13git+0x45012a)
#12 0x00007f2fd5a85bbc clang::CodeGen::CodeGenFunction::FinishFunction(clang::SourceLocation) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:405:3
#13 0x00007f2fd587f703 clang::CodeGen::CodeGenFunction::GenerateSEHFinallyFunction(clang::CodeGen::CodeGenFunction&, clang::SEHFinallyStmt const&) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CGException.cpp:2005:10
#14 0x00007f2fd587f776 pushCleanup<(anonymous namespace)::PerformSEHFinally, llvm::Function*> ~/github.com/llvm/llvm-project/clang/lib/CodeGen/EHScopeStack.h:273:31
#15 0x00007f2fd587f776 clang::CodeGen::CodeGenFunction::EnterSEHTryStmt(clang::SEHTryStmt const&) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CGException.cpp:2082:43
#16 0x00007f2fd587fa87 clang::CodeGen::CodeGenFunction::getJumpDestInCurrentScope(llvm::StringRef) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:1096:59
#17 0x00007f2fd587fa87 clang::CodeGen::CodeGenFunction::EmitSEHTryStmt(clang::SEHTryStmt const&) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CGException.cpp:1605:65
#18 0x00007f2fd5a21de4 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CGStmt.cpp:447:31
#19 0x00007f2fd5a8499b clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1185:36
#20 0x00007f2fd5a9214a clang::CodeGen::CodeGenModule::getLangOpts() const ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenModule.h:686:51
#21 0x00007f2fd5a9214a clang::CodeGen::CodeGenFunction::getLangOpts() const ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:1921:67
#22 0x00007f2fd5a9214a clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1352:19
#23 0x00007f2fd5ad447c clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4791:3
#24 0x00007f2fd5ad0f7b clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3177:47
#25 0x00007f2fd5ad8c8a clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5895:1
#26 0x00007f2fd5b4e9a1 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:169:67
#27 0x00007f2fd5a70b13 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) ~/github.com/llvm/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:217:7
#28 0x00007f2fcfbbd814 clang::ParseAST(clang::Sema&, bool, bool) ~/github.com/llvm/llvm-project/clang/lib/Parse/ParseAST.cpp:162:17
#29 0x00007f2fd3e3f4b9 clang::FrontendAction::Execute() ~/github.com/llvm/llvm-project/clang/lib/Frontend/FrontendAction.cpp:949:21
#30 0x00007f2fd3dd4cd6 llvm::Error::setChecked(bool) ~/github.com/llvm/llvm-project/llvm/include/llvm/Support/Error.h:305:22
#31 0x00007f2fd3dd4cd6 llvm::Error::operator bool() ~/github.com/llvm/llvm-project/llvm/include/llvm/Support/Error.h:236:15
#32 0x00007f2fd3dd4cd6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ~/github.com/llvm/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:955:42
#33 0x00007f2fd68e1a5b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ~/github.com/llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:279:32
#34 0x0000000000219694 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ~/github.com/llvm/llvm-project/clang/tools/driver/cc1_main.cpp:246:40
#35 0x0000000000212ced ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) ~/github.com/llvm/llvm-project/clang/tools/driver/driver.cpp:335:20
#36 0x00007f2fd3b56c85 operator() ~/github.com/llvm/llvm-project/clang/lib/Driver/Job.cpp:404:32
#37 0x00007f2fd3b56c85 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) ~/github.com/llvm/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:52
#38 0x00007f2fd2036a34 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) ~/github.com/llvm/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:425:10
#39 0x00007f2fd3b578eb clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) ~/github.com/llvm/llvm-project/clang/lib/Driver/Job.cpp:408:10
#40 0x00007f2fd3b28552 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const ~/github.com/llvm/llvm-project/clang/lib/Driver/Compilation.cpp:196:3
#41 0x00007f2fd3b28c31 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const ~/github.com/llvm/llvm-project/clang/lib/Driver/Compilation.cpp:248:5
#42 0x00007f2fd3b34d71 llvm::SmallVectorBase<unsigned int>::empty() const ~/github.com/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:73:47
#43 0x00007f2fd3b34d71 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) ~/github.com/llvm/llvm-project/clang/lib/Driver/Driver.cpp:1539:28
#44 0x000000000021640a main ~/github.com/llvm/llvm-project/clang/tools/driver/driver.cpp:510:5
#45 0x00007f2fd1a361e2 __libc_start_main /usr/src/debug/glibc-2.32-37-g760e1d2878/csu/../csu/libc-start.c:314:16
#46 0x00000000002120ee _start (~/llvm/inst/bin/clang-cl+0x2120ee)
clang-12: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 13.0.0 (git at github.com:llvm/llvm-project 2224221fb3fa9738bd84221ed048247089187fce)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: ~/llvm/inst/bin
(It still works fine if you change the function's exception specification from `nothrow` to `throw()`.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97687/new/
https://reviews.llvm.org/D97687
More information about the cfe-commits
mailing list