-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crash on lambda of unevaluated context as template type parameter #51414
Labels
bugzilla
Issues migrated from bugzilla
c++20
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
release:backport
Comments
EugeneZelenko
added
the
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
label
Mar 25, 2022
@llvm/issue-subscribers-clang-frontend |
/cherry-pick 3784e8c |
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this issue
Apr 2, 2022
Unlike other types, when lambdas are instanciated, they are recreated from scratch. When an unevaluated lambdas appear in the type of a function, parameter it is instanciated in the wrong declaration context, as parameters are transformed before the function. To support lambda in function parameters, we try to compute whether they are dependant without looking at the declaration context. This is a short term stopgap solution to avoid clang iceing. A better fix might be to inject some kind of transparent declaration with correctly computed dependency for function parameters, variable templates, etc. Fixes llvm#50376 Fixes llvm#51414 Fixes llvm#51416 Fixes llvm#51641 Fixes llvm#54296 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121532 (cherry picked from commit 3784e8c)
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this issue
Apr 2, 2022
Unlike other types, when lambdas are instanciated, they are recreated from scratch. When an unevaluated lambdas appear in the type of a function, parameter it is instanciated in the wrong declaration context, as parameters are transformed before the function. To support lambda in function parameters, we try to compute whether they are dependant without looking at the declaration context. This is a short term stopgap solution to avoid clang iceing. A better fix might be to inject some kind of transparent declaration with correctly computed dependency for function parameters, variable templates, etc. Fixes llvm#50376 Fixes llvm#51414 Fixes llvm#51416 Fixes llvm#51641 Fixes llvm#54296 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121532 (cherry picked from commit 3784e8c)
/branch llvmbot/llvm-project/issue51414 |
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this issue
Apr 2, 2022
Unlike other types, when lambdas are instanciated, they are recreated from scratch. When an unevaluated lambdas appear in the type of a function, parameter it is instanciated in the wrong declaration context, as parameters are transformed before the function. To support lambda in function parameters, we try to compute whether they are dependant without looking at the declaration context. This is a short term stopgap solution to avoid clang iceing. A better fix might be to inject some kind of transparent declaration with correctly computed dependency for function parameters, variable templates, etc. Fixes llvm#50376 Fixes llvm#51414 Fixes llvm#51416 Fixes llvm#51641 Fixes llvm#54296 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121532 (cherry picked from commit 3784e8c)
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this issue
Apr 2, 2022
Unlike other types, when lambdas are instanciated, they are recreated from scratch. When an unevaluated lambdas appear in the type of a function, parameter it is instanciated in the wrong declaration context, as parameters are transformed before the function. To support lambda in function parameters, we try to compute whether they are dependant without looking at the declaration context. This is a short term stopgap solution to avoid clang iceing. A better fix might be to inject some kind of transparent declaration with correctly computed dependency for function parameters, variable templates, etc. Fixes llvm#50376 Fixes llvm#51414 Fixes llvm#51416 Fixes llvm#51641 Fixes llvm#54296 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121532 (cherry picked from commit 3784e8c)
/pull-request llvmbot#150 |
mem-frob
pushed a commit
to draperlaboratory/hope-llvm-project
that referenced
this issue
Oct 7, 2022
Unlike other types, when lambdas are instanciated, they are recreated from scratch. When an unevaluated lambdas appear in the type of a function, parameter it is instanciated in the wrong declaration context, as parameters are transformed before the function. To support lambda in function parameters, we try to compute whether they are dependant without looking at the declaration context. This is a short term stopgap solution to avoid clang iceing. A better fix might be to inject some kind of transparent declaration with correctly computed dependency for function parameters, variable templates, etc. Fixes llvm/llvm-project#50376 Fixes llvm/llvm-project#51414 Fixes llvm/llvm-project#51416 Fixes llvm/llvm-project#51641 Fixes llvm/llvm-project#54296 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121532
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bugzilla
Issues migrated from bugzilla
c++20
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
release:backport
Extended Description
GCC supports following code by rebuilding function type:
template void spam(decltype([]{}) (*s)[sizeof(T)] = nullptr)
{ }
void foo()
{
spam();
}
clang-13 crashes:
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: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20
#0 0x0000556ede5a211f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x0000556ede59ffe0 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x359ffe0)
#2 0x0000556ede4efe48 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f3c9cef33c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x0000556ede9dda66 clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dda66)
#5 0x0000556ede9dcd73 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dcd73)
#6 0x0000556ede9dda04 clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dda04)
#7 0x0000556ede9dca88 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dca88)
#8 0x0000556edea44821 (anonymous namespace)::X86_64ABIInfo::classifyArgumentType(clang::QualType, unsigned int, unsigned int&, unsigned int&, bool) const TargetInfo.cpp:0:0
#9 0x0000556edea45da0 (anonymous namespace)::X86_64ABIInfo::computeInfo(clang::CodeGen::CGFunctionInfo&) const TargetInfo.cpp:0:0
#10 0x0000556edeb5324a clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQualclang::Type, bool, bool, llvm::ArrayRef<clang::CanQualclang::Type >, clang::FunctionType::ExtInfo, llvm::ArrayRefclang::FunctionType::ExtParameterInfo, clang::CodeGen::RequiredArgs) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b5324a)
#11 0x0000556edeb55a26 clang::CodeGen::CodeGenTypes::arrangeFreeFunctionType(clang::CanQualclang::FunctionProtoType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3b55a26)
#12 0x0000556ede9dbc25 clang::CodeGen::CodeGenTypes::ConvertFunctionTypeInternal(clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dbc25)
#13 0x0000556ede9dce2b clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39dce2b)
#14 0x0000556ede9a6073 clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl, llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a6073)
#15 0x0000556edebaa8f6 EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&, clang::GlobalDecl) CGExpr.cpp:0:0
#16 0x0000556edebaaba0 EmitDirectCallee(clang::CodeGen::CodeGenFunction&, clang::GlobalDecl) (.isra.1047) CGExpr.cpp:0:0
#17 0x0000556edebc7ea1 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc7ea1)
#18 0x0000556edebc7ed3 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc7ed3)
#19 0x0000556edebc8081 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc8081)
#20 0x0000556edec03f6b (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#21 0x0000556edebf8693 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#22 0x0000556edebface3 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bface3)
#23 0x0000556edebafb47 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bafb47)
#24 0x0000556edebc6c6e clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bc6c6e)
#25 0x0000556ede90508c clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x390508c)
#26 0x0000556ede90a5ac clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x390a5ac)
#27 0x0000556ede958169 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3958169)
#28 0x0000556ede960983 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3960983)
#29 0x0000556ede9a627e clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a627e)
#30 0x0000556ede9a30c5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a30c5)
#31 0x0000556ede9a37cb clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x39a37cb)
#32 0x0000556ede9a93e1 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5289) CodeGenModule.cpp:0:0
#33 0x0000556edf5415b1 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#34 0x0000556edf534802 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4534802)
#35 0x0000556ee0378cc4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5378cc4)
#36 0x0000556edf53f5e2 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x453f5e2)
#37 0x0000556edeed5df1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ed5df1)
#38 0x0000556edee729c2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e729c2)
#39 0x0000556edefa3413 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fa3413)
#40 0x0000556edc2d327c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12d327c)
#41 0x0000556edc2cf2ed ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#42 0x0000556eded17805 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const::'lambda'()>(long) Job.cpp:0:0
#43 0x0000556ede4f0433 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x34f0433)
#44 0x0000556eded198be clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3d198be)
#45 0x0000556edecef12a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cef12a)
#46 0x0000556edecefc6f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cefc6f)
#47 0x0000556edecf90a5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3cf90a5)
#48 0x0000556edc1e30ae main (/opt/compiler-explorer/clang-trunk/bin/clang+++0x11e30ae)
#49 0x00007f3c9c9a30b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#50 0x0000556edc2cee6a _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0x12cee6a)
clang-14: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
The text was updated successfully, but these errors were encountered: