[llvm-bugs] [Bug 49505] New: Clang frontend command failed when using wrong constraint functions

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 10 01:32:56 PST 2021


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

            Bug ID: 49505
           Summary: Clang frontend command failed when using wrong
                    constraint functions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          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 will trigger the clang frontend error:

template <typename T>
concept C = requires (T = {}) { true; };

auto f(C auto) {}

int main() { f(0); }

(godbolt: https://godbolt.org/z/1cPexc)





error message:

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>:6:17: current parser token ')'
2.      <source>:6:12: parsing function body 'main'
3.      <source>:6:12: in compound statement ('{}')
 #0 0x00005561a79561ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x307d1ec)
 #1 0x00005561a7953f94 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x307af94)
 #2 0x00005561a7954215 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x307b215)
 #3 0x00005561a78b91c8 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #4 0x00007fb5cd3263c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x00005561aa0df9e4 clang::DeclContext::isDependentContext() const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x58069e4)
 #6 0x00005561aa0dfb34 clang::Decl::isInLocalScopeForInstantiation() const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5806b34)
 #7 0x00005561a9d73e11 clang::Sema::SubstParmVarDecl(clang::ParmVarDecl*,
clang::MultiLevelTemplateArgumentList const&, int, llvm::Optional<unsigned
int>, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x549ae11)
 #8 0x00005561a9d74ed2 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformFunctionTypeParams(clang::SourceLocation,
llvm::ArrayRef<clang::ParmVarDecl*>, clang::QualType const*,
clang::FunctionType::ExtParameterInfo const*,
llvm::SmallVectorImpl<clang::QualType>&,
llvm::SmallVectorImpl<clang::ParmVarDecl*>*,
clang::Sema::ExtParameterInfoBuilder&) SemaTemplateInstantiate.cpp:0:0
 #9 0x00005561a9d75dda clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformRequiresExpr(clang::RequiresExpr*)
SemaTemplateInstantiate.cpp:0:0
#10 0x00005561a9d59b89 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
SemaTemplateInstantiate.cpp:0:0
#11 0x00005561a9d62db6 clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5489db6)
#12 0x00005561a97b5487 calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr
const*)::operator()(clang::Expr const*) const SemaConcept.cpp:0:0
#13 0x00005561a97b7113 bool
calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr
const*)>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&,
calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*,
llvm::ArrayRef<clang::TemplateArgument>, clang::SourceLocation,
clang::MultiLevelTemplateArgumentList&, clang::Expr const*,
clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)&&)
SemaConcept.cpp:0:0
#14 0x00005561a97b7b20
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4edeb20)
#15 0x00005561a9c8441e clang::Sema::CheckConceptTemplateId(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::DeclarationNameInfo const&,
clang::NamedDecl*, clang::ConceptDecl*, clang::TemplateArgumentListInfo const*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x53ab41e)
#16 0x00005561a9d6abbc clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformConceptSpecializationExpr(clang::ConceptSpecializationExpr*)
SemaTemplateInstantiate.cpp:0:0
#17 0x00005561a9d59874 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
SemaTemplateInstantiate.cpp:0:0
#18 0x00005561a9d62db6 clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5489db6)
#19 0x00005561a97b5487 calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr
const*)::operator()(clang::Expr const*) const SemaConcept.cpp:0:0
#20 0x00005561a97b7113 bool
calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::'lambda'(clang::Expr
const*)>(clang::Sema&, clang::Expr const*, clang::ConstraintSatisfaction&,
calculateConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*,
llvm::ArrayRef<clang::TemplateArgument>, clang::SourceLocation,
clang::MultiLevelTemplateArgumentList&, clang::Expr const*,
clang::ConstraintSatisfaction&)::'lambda'(clang::Expr const*)&&)
SemaConcept.cpp:0:0
#21 0x00005561a97b7b20
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4edeb20)
#22 0x00005561a9d897fa
clang::Sema::CheckInstantiatedFunctionTemplateConstraints(clang::SourceLocation,
clang::FunctionDecl*, llvm::ArrayRef<clang::TemplateArgument>,
clang::ConstraintSatisfaction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x54b07fa)
#23 0x00005561a9d2f2db
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+++0x54562db)
#24 0x00005561a9d2fd1e 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
#25 0x00005561a96b983f
clang::Sema::runWithSufficientStackSpace(clang::SourceLocation,
llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4de083f)
#26 0x00005561a9d3bbd2
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+++0x5462bd2)
#27 0x00005561a9bfd5ff
clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool,
clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x53245ff)
#28 0x00005561a9bfeb02
clang::Sema::AddOverloadedCallCandidates(clang::UnresolvedLookupExpr*,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5325b02)
#29 0x00005561a9bfee7a clang::Sema::buildOverloadedCallSet(clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation,
clang::OverloadCandidateSet*, clang::ActionResult<clang::Expr*, true>*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x5325e7a)
#30 0x00005561a9c03b45 clang::Sema::BuildOverloadedCallExpr(clang::Scope*,
clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool,
bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x532ab45)
#31 0x00005561a9986468 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+++0x50ad468)
#32 0x00005561a99870e4 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x50ae0e4)
#33 0x00005561a960a9c0
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d319c0)
#34 0x00005561a960515f
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d2c15f)
#35 0x00005561a9607b56
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d2eb56)
#36 0x00005561a9608d14
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d2fd14)
#37 0x00005561a96099c9
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d309c9)
#38 0x00005561a9668acd
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d8facd)
#39 0x00005561a9660b3b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d87b3b)
#40 0x00005561a9660f4d
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d87f4d)
#41 0x00005561a9661a61 clang::Parser::ParseCompoundStatementBody(bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d88a61)
#42 0x00005561a9665283 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d8c283)
#43 0x00005561a95bcbc7
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ce3bc7)
#44 0x00005561a95e5215 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4d0c215)
#45 0x00005561a95b8321
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cdf321)
#46 0x00005561a95b8a51
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.241) Parser.cpp:0:0
#47 0x00005561a95be9d9
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ce59d9)
#48 0x00005561a95bff59
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4ce6f59)
#49 0x00005561a95b31b9 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x4cda1b9)
#50 0x00005561a87e12d2 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f082d2)
#51 0x00005561a81d6f31 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x38fdf31)
#52 0x00005561a8177013
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x389e013)
#53 0x00005561a829e2d3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x39c52d3)
#54 0x00005561a58b875c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xfdf75c)
#55 0x00005561a58b48dd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#56 0x00005561a802d705 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
#57 0x00005561a78b92a3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fe02a3)
#58 0x00005561a802e038
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
#59 0x00005561a800640a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x372d40a)
#60 0x00005561a8006f5f
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+++0x372df5f)
#61 0x00005561a800fe65
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-trunk/bin/clang+++0x3736e65)
#62 0x00005561a57d19be main
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xef89be)
#63 0x00007fb5ccdd70b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#64 0x00005561a58b445a _start
(/opt/compiler-explorer/clang-trunk/bin/clang+++0xfdb45a)

-- 
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/20210310/dffed1d6/attachment-0001.html>


More information about the llvm-bugs mailing list