[llvm-bugs] [Bug 47043] New: Clang crashes while checking constraints of a concept parameter pack that is missing an ellipsis

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 7 14:36:51 PDT 2020


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

            Bug ID: 47043
           Summary: Clang crashes while checking constraints of a concept
                    parameter pack that is missing an ellipsis
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ezra at ezisland.org
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The clang frontend will crash if a user accidentally omits the ellipsis when
attempting to expand a parameter pack inside of a concept's parameter list. In
the reproduction steps below, the parameter pack T is written without the
ellipses in the second line (Foo<T>). When both Foo and Bar are concepts, this
causes clang to crash instead of emitting the usual diagnostic. This issue
appears could be a duplicate of two previously reported bugs #45770 and #45699. 

$ uname -a

Linux 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64
GNU/Linux

$ clang++-12 -v

Debian clang version 12.0.0-++20200715052739+d6e79e3dd6d-1~exp1

$ cat foo.cpp

template<typename... T> concept Foo = true;
template<typename... T> concept Bar = Foo<T>; // vs Foo<T...>
static_assert(Bar<int, int, int>);

$ clang++-12 -std=c++20 foo.cpp

#0 0x00007fb7c2fd374f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-12.so.1+0xb0f74f)
 #1 0x00007fb7c2fd1ab0 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-12.so.1+0xb0dab0)
 #2 0x00007fb7c2fd3c25 (/usr/lib/x86_64-linux-gnu/libLLVM-12.so.1+0xb0fc25)
 #3 0x00007fb7c9edb140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007fb7c7ebaf7b (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xc83f7b)
 #5 0x00007fb7c7e9404a (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xc5d04a)
 #6 0x00007fb7c7e96551 (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xc5f551)
 #7 0x00007fb7c7e920a9 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&,
clang::ASTContext const&, bool) const
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xc5b0a9)
 #8 0x00007fb7c830ab8c (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x10d3b8c)
 #9 0x00007fb7c8305a32
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x10cea32)
#10 0x00007fb7c87416a1 clang::Sema::CheckConceptTemplateId(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::DeclarationNameInfo const&,
clang::NamedDecl*, clang::ConceptDecl*, clang::TemplateArgumentListInfo const*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x150a6a1)
#11 0x00007fb7c8741997 clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::LookupResult&, bool,
clang::TemplateArgumentListInfo const*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x150a997)
#12 0x00007fb7c846c3be clang::Sema::ActOnIdExpression(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*, bool, clang::Token*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x12353be)
#13 0x00007fb7c7c57122
clang::Parser::tryParseCXXIdExpression(clang::CXXScopeSpec&, bool,
clang::Token&) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa20122)
#14 0x00007fb7c7c581ca clang::Parser::ParseCXXIdExpression(bool)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa211ca)
#15 0x00007fb7c7c47e5e
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa10e5e)
#16 0x00007fb7c7c4b5aa
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa145aa)
#17 0x00007fb7c7c46d36
clang::Parser::ParseConstantExpressionInExprEvalContext(clang::Parser::TypeCastState)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa0fd36)
#18 0x00007fb7c7c34f3e
clang::Parser::ParseStaticAssertDeclaration(clang::SourceLocation&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x9fdf3e)
#19 0x00007fb7c7c1bf2a
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*) (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x9e4f2a)
#20 0x00007fb7c7cac94f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa7594f)
#21 0x00007fb7c7cab75b
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0xa7475b)
#22 0x00007fb7c7c0e17d clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x9d717d)
#23 0x00007fb7c91d75f8 clang::FrontendAction::Execute()
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x1fa05f8)
#24 0x00007fb7c918d8c1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x1f568c1)
#25 0x00007fb7c923cf40
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.12+0x2005f40)
#26 0x00000000004131bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-12/bin/clang+0x4131bf)
#27 0x00000000004115fe (/usr/lib/llvm-12/bin/clang+0x4115fe)
#28 0x000000000041140a main (/usr/lib/llvm-12/bin/clang+0x41140a)
#29 0x00007fb7c1ff8cca __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x26cca)
#30 0x000000000040e89a _start (/usr/lib/llvm-12/bin/clang+0x40e89a)

-- 
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/20200807/7d1c476b/attachment-0001.html>


More information about the llvm-bugs mailing list