[llvm-bugs] [Bug 52526] New: Parser crash when checking templated lambda type in concept

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 16 11:57:40 PST 2021


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

            Bug ID: 52526
           Summary: Parser crash when checking templated lambda type in
                    concept
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: neyl.jaber at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 25453
  --> https://bugs.llvm.org/attachment.cgi?id=25453&action=edit
tmp/main-38cf0d.cpp followed by /tmp/main-38cf0d.sh

The clang parser crashes on the following code :

///////////////////////////////////////////////////////////////////////////////
template<auto L>
concept C = requires {
        typename decltype(L)::template operator()<int>;
};

template<auto L> requires C<L> struct S {};

auto x = S<[]<typename T>(T){}>;
///////////////////////////////////////////////////////////////////////////////


Backtrace:


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: /usr/lib/llvm-13/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name main.cpp
-mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic
-debugger-tuning=gdb -fcoverage-compilation-dir=/home/neyl/Corrections/test
-resource-dir /usr/lib/llvm-13/lib/clang/13.0.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward
-internal-isystem /usr/lib/llvm-13/lib/clang/13.0.0/include -internal-isystem
/usr/local/include -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++20 -fdeprecated-macro
-fdebug-compilation-dir=/home/neyl/Corrections/test -ferror-limit 19
-fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions
-faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/main-7fc110.o -x c++ main.cpp
1.      main.cpp:9:10: at annotation token
 #0 0x00007fe4d76fb183 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbb9183)
 #1 0x00007fe4d76f9500 llvm::sys::RunSignalHandlers()
(/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbb7500)
 #2 0x00007fe4d76fb61a (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbb961a)
 #3 0x00007fe4d6649520 (/lib/x86_64-linux-gnu/libc.so.6+0x46520)
 #4 0x00007fe4dd22b842 clang::Selector::getAsString[abi:cxx11]() const
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xb05842)
 #5 0x00007fe4dd22b9a3 clang::Selector::print(llvm::raw_ostream&) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xb059a3)
 #6 0x00007fe4dd556d24 clang::DeclarationName::print(llvm::raw_ostream&,
clang::PrintingPolicy const&) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xe30d24)
 #7 0x00007fe4dd557493 clang::operator<<(llvm::raw_ostream&,
clang::DeclarationName) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xe31493)
 #8 0x00007fe4dd40cc9d
clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind,
long, llvm::StringRef, llvm::StringRef,
llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long> >,
llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xce6c9d)
 #9 0x00007fe4dd213219 clang::Diagnostic::FormatDiagnostic(char const*, char
const*, llvm::SmallVectorImpl<char>&) const
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xaed219)
#10 0x00007fe4dda8b78c (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x136578c)
#11 0x00007fe4ddf6a62e (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x184462e)
#12 0x00007fe4ddf6278d (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x183c78d)
#13 0x00007fe4ddf518af clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x182b8af)
#14 0x00007fe4dda8b0a8 (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x13650a8)
#15 0x00007fe4dda86293
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1360293)
#16 0x00007fe4dde8e842 clang::Sema::CheckConceptTemplateId(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::DeclarationNameInfo const&,
clang::NamedDecl*, clang::ConceptDecl*, clang::TemplateArgumentListInfo const*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1768842)
#17 0x00007fe4ddf5e158 (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1838158)
#18 0x00007fe4ddf518af clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x182b8af)
#19 0x00007fe4dda8b0a8 (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x13650a8)
#20 0x00007fe4dda86293
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1360293)
#21 0x00007fe4dda86e11
clang::Sema::EnsureTemplateArgumentListConstraints(clang::TemplateDecl*,
llvm::ArrayRef<clang::TemplateArgument>, clang::SourceRange)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1360e11)
#22 0x00007fe4dde889cb
clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*,
clang::SourceLocation, clang::TemplateArgumentListInfo&, bool,
llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x17629cb)
#23 0x00007fe4dde86f04 clang::Sema::CheckTemplateIdType(clang::TemplateName,
clang::SourceLocation, clang::TemplateArgumentListInfo&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1760f04)
#24 0x00007fe4dde89bfa clang::Sema::ActOnTemplateIdType(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation,
clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo*,
clang::SourceLocation, clang::SourceLocation,
llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation,
bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x1763bfa)
#25 0x00007fe4dd3b28c7
clang::Parser::AnnotateTemplateIdTokenAsType(clang::CXXScopeSpec&, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc8c8c7)
#26 0x00007fe4dd3c0c1c
clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(clang::CXXScopeSpec&,
bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc9ac1c)
#27 0x00007fe4dd3c0fdf clang::Parser::TryAnnotateTypeOrScopeToken()
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc9afdf)
#28 0x00007fe4dd3532e6
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc2d2e6)
#29 0x00007fe4dd34d362
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc27362)
#30 0x00007fe4dd3281ff
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc021ff)
#31 0x00007fe4dd325cf6 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xbffcf6)
#32 0x00007fe4dd3bdefd
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc97efd)
#33 0x00007fe4dd3bd8dc
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc978dc)
#34 0x00007fe4dd3bcdc1
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc96dc1)
#35 0x00007fe4dd3bb430
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xc95430)
#36 0x00007fe4dd3115dd clang::ParseAST(clang::Sema&, bool, bool)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0xbeb5dd)
#37 0x00007fe4dea57748 clang::FrontendAction::Execute()
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x2331748)
#38 0x00007fe4de9d8a56
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x22b2a56)
#39 0x00007fe4deac5330
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/lib/x86_64-linux-gnu/libclang-cpp.so.13+0x239f330)
#40 0x0000000000412fc3 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-13/bin/clang+0x412fc3)
#41 0x0000000000411055 (/usr/lib/llvm-13/bin/clang+0x411055)
#42 0x0000000000410ed6 main (/usr/lib/llvm-13/bin/clang+0x410ed6)
#43 0x00007fe4d6630fd0 __libc_start_call_main
./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#44 0x00007fe4d663107d call_init ./csu/../csu/libc-start.c:128:20
#45 0x00007fe4d663107d __libc_start_main ./csu/../csu/libc-start.c:379:5
#46 0x000000000040e1c5 _start (/usr/lib/llvm-13/bin/clang+0x40e1c5)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Ubuntu clang version 13.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
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/main-38cf0d.cpp
clang: note: diagnostic msg: /tmp/main-38cf0d.sh
clang: note: diagnostic msg: 

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

-- 
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/20211116/5b5864cd/attachment-0001.html>


More information about the llvm-bugs mailing list