crash on lambda of unevaluated context as template type parameter · Issue #51414 · llvm/llvm-project (original) (raw)
Bugzilla Link | 52072 |
---|---|
Version | trunk |
OS | Linux |
CC | @AaronBallman,@dwblaikie,@zygoloid |
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
- parser at end of file
- :4:6: LLVM IR generation of declaration 'foo'
- :4:6: Generating code for declaration 'foo'
#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