[llvm-bugs] [Bug 49424] New: Clang frontend command failed when parse template lambda in function arguments

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 3 20:52:24 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49424

            Bug ID: 49424
           Summary: Clang frontend command failed when parse template
                    lambda in function arguments
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hewillk at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code with "-std+c++20" will emit the clang frontend error:

auto f(auto x = 1, auto = [] <auto = x> {} ());

godbolt: https://godbolt.org/z/Ghq8fM





details:
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
./output.s -mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics
-fno-crash-diagnostics -std=c++20 <source>
1.      <source>:1:45: current parser token ')'
 #0 0x0000558e41b4f2dc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x305c2dc)
 #1 0x0000558e41b4d084 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x305a084)
 #2 0x0000558e41b4d305 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x305a305)
 #3 0x0000558e41ab3b28 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #4 0x00007fc1e5ede3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x0000558e442a19c4 clang::DeclContext::isDependentContext() const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x57ae9c4)
 #6 0x0000558e442a1b14 clang::Decl::isInLocalScopeForInstantiation() const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x57aeb14)
 #7 0x0000558e43f35db1 clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
clang::MultiLevelTemplateArgumentList const&, int, llvm::Optional<unsigned
int>, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5442db1)
 #8 0x0000558e43f61f14 void llvm::function_ref<void
()>::callback_fn<clang::Sema::SubstDecl(clang::Decl*, clang::DeclContext*,
clang::MultiLevelTemplateArgumentList const&)::'lambda'()>(long)
SemaTemplateInstantiateDecl.cpp:0:0
 #9 0x0000558e438a199f
clang::Sema::runWithSufficientStackSpace(clang::SourceLocation,
llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4dae99f)
#10 0x0000558e43f4aaa3 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5457aa3)
#11 0x0000558e43f5441d clang::Sema::FindInstantiatedDecl(clang::SourceLocation,
clang::NamedDecl*, clang::MultiLevelTemplateArgumentList const&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x546141d)
#12 0x0000558e43f0eacb (anonymous
namespace)::TemplateInstantiator::TransformDecl(clang::SourceLocation,
clang::Decl*) SemaTemplateInstantiate.cpp:0:0
#13 0x0000558e43f33943 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDeclRefExpr(clang::DeclRefExpr*)
SemaTemplateInstantiate.cpp:0:0
#14 0x0000558e43f1b832 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
SemaTemplateInstantiate.cpp:0:0
#15 0x0000558e43f1b7a9 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
SemaTemplateInstantiate.cpp:0:0
#16 0x0000558e43f24d16 clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5431d16)
#17 0x0000558e43e2d7b4 SubstDefaultTemplateArgument(clang::Sema&,
clang::TemplateDecl*, clang::SourceLocation, clang::SourceLocation,
clang::NonTypeTemplateParmDecl*,
llvm::SmallVectorImpl<clang::TemplateArgument>&) SemaTemplate.cpp:0:0
#18 0x0000558e43e2dcf7
clang::Sema::SubstDefaultTemplateArgumentIfAvailable(clang::TemplateDecl*,
clang::SourceLocation, clang::SourceLocation, clang::Decl*,
llvm::SmallVectorImpl<clang::TemplateArgument>&, bool&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x533acf7)
#19 0x0000558e43ef06ab
clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool,
llvm::function_ref<bool ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x53fd6ab)
#20 0x0000558e43ef1f4e void llvm::function_ref<void
()>::callback_fn<clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool,
llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>)::'lambda1'()>(long)
SemaTemplateDeduction.cpp:0:0
#21 0x0000558e438a199f
clang::Sema::runWithSufficientStackSpace(clang::SourceLocation,
llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4dae99f)
#22 0x0000558e43efdee2
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool,
llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x540aee2)
#23 0x0000558e43dbe2fc
clang::Sema::AddMethodTemplateCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::CXXRecordDecl*, clang::TemplateArgumentListInfo*,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool, bool, clang::OverloadCandidateParamOrder)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x52cb2fc)
#24 0x0000558e43dbe5cf clang::Sema::AddMethodCandidate(clang::DeclAccessPair,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x52cb5cf)
#25 0x0000558e43dce120 clang::Sema::BuildCallToObjectOfClassType(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x52db120)
#26 0x0000558e43b6d402 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x507a402)
#27 0x0000558e43b6dfd4 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x507afd4)
#28 0x0000558e437f3a30
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d00a30)
#29 0x0000558e437ee1cf
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cfb1cf)
#30 0x0000558e437f0bc6
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cfdbc6)
#31 0x0000558e437f1d84
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cfed84)
#32 0x0000558e437d1146
clang::Parser::ParseParameterDeclarationClause(clang::DeclaratorContext,
clang::ParsedAttributes&,
llvm::SmallVectorImpl<clang::DeclaratorChunk::ParamInfo>&,
clang::SourceLocation&) (.part.359) ParseDecl.cpp:0:0
#33 0x0000558e437d18a5
clang::Parser::ParseParameterDeclarationClause(clang::DeclaratorContext,
clang::ParsedAttributes&,
llvm::SmallVectorImpl<clang::DeclaratorChunk::ParamInfo>&,
clang::SourceLocation&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cde8a5)
#34 0x0000558e437d33b4
clang::Parser::ParseFunctionDeclarator(clang::Declarator&,
clang::ParsedAttributes&, clang::BalancedDelimiterTracker&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ce03b4)
#35 0x0000558e437d4855 clang::Parser::ParseDirectDeclarator(clang::Declarator&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ce1855)
#36 0x0000558e437c0a6a
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&))
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ccda6a)
#37 0x0000558e437cdf7f clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cdaf7f)
#38 0x0000558e437a15b1
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cae5b1)
#39 0x0000558e437a1ce1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.241) Parser.cpp:0:0
#40 0x0000558e437a7c69
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cb4c69)
#41 0x0000558e437a91e9
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cb61e9)
#42 0x0000558e437a97d5
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cb67d5)
#43 0x0000558e4379c413 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ca9413)
#44 0x0000558e429cb582 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ed8582)
#45 0x0000558e423c6861 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x38d3861)
#46 0x0000558e42366353
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3873353)
#47 0x0000558e4248d973
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x399a973)
#48 0x0000558e3fac80fc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xfd50fc)
#49 0x0000558e3fac427d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#50 0x0000558e42220ff5 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) Job.cpp:0:0
#51 0x0000558e41ab3c03
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fc0c03)
#52 0x0000558e42221928
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.166) Job.cpp:0:0
#53 0x0000558e421f9cfa
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3706cfa)
#54 0x0000558e421fa84f
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+++0x370784f)
#55 0x0000558e42203755
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3710755)
#56 0x0000558e3f9e1f0e main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xeeef0e)
#57 0x00007fc1e598f0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#58 0x0000558e3fac3dfa _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xfd0dfa)
clang-13: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
Compiler returned: 139

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210304/0aeb8c5c/attachment.html>


More information about the llvm-bugs mailing list