Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang 15.0.2 front-end crash on constrained inner class template #58960

Closed
rvfq opened this issue Nov 13, 2022 · 4 comments
Closed

clang 15.0.2 front-end crash on constrained inner class template #58960

rvfq opened this issue Nov 13, 2022 · 4 comments
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@rvfq
Copy link

rvfq commented Nov 13, 2022

https://godbolt.org/z/q41vrPras

Stack dump:
0.      Program arguments: clang -emit-llvm -Xclang -disable-llvm-passes -g -ggdb3 -std=c++20 -march=native -o t.o -c t.cxx
1.      t.cxx:14:33: current parser token 't'
2.      t.cxx:6:1: parsing struct/union/class body 'S'
 #0 0x0000000002fcc824 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000000002fca544 llvm::sys::CleanupOnSignal(unsigned long) (/usr/local/bin/clang-15+0x2fca544)
 #2 0x0000000002f11298 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fd0905c62d0 __restore_rt (/lib64/libpthread.so.0+0x132d0)
 #4 0x0000000005725c21 clang::ASTContext::getSubstTemplateTypeParmType(clang::TemplateTypeParmType const*, clang::QualType) const (/usr/local/bin/clang-15+0x5725c21)
 #5 0x00000000054e96e8 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&, clang::TypeLoc) SemaTemplateInstantiate.cpp:0:0
 #6 0x00000000054ece55 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*) SemaTemplateInstantiate.cpp:0:0
 #7 0x00000000054f0075 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformTemplateArgument(clang::TemplateArgumentLoc const&, clang::TemplateArgumentLoc&, bool) SemaTemplateInstantiate.cpp:0:0
 #8 0x00000000054f3942 bool clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformTemplateArguments<clang::TemplateArgumentLoc const*>(clang::TemplateArgumentLoc const*, clang::TemplateArgumentLoc const*, clang::TemplateArgumentListInfo&, bool) (.constprop.0) SemaTemplateInstantiate.cpp:0:0
 #9 0x00000000054f4517 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformConceptSpecializationExpr(clang::ConceptSpecializationExpr*) SemaTemplateInstantiate.cpp:0:0
#10 0x000000000550ab96 clang::Sema::SubstExpr(clang::Expr*, clang::MultiLevelTemplateArgumentList const&) (/usr/local/bin/clang-15+0x550ab96)
#11 0x0000000004e47135 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
#12 0x0000000004e48e2b CheckConstraintSatisfaction(clang::Sema&, clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>, clang::SourceRange, clang::ConstraintSatisfaction&) SemaConcept.cpp:0:0
#13 0x0000000004e4904d clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>, clang::SourceRange, clang::ConstraintSatisfaction&) (/usr/local/bin/clang-15+0x4e4904d)
#14 0x0000000004e49859 clang::Sema::EnsureTemplateArgumentListConstraints(clang::TemplateDecl*, llvm::ArrayRef<clang::TemplateArgument>, clang::SourceRange) (/usr/local/bin/clang-15+0x4e49859)
#15 0x0000000005405ea6 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/usr/local/bin/clang-15+0x5405ea6)
#16 0x0000000005409d00 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/usr/local/bin/clang-15+0x5409d00)
#17 0x0000000004d5f527 clang::Sema::ActOnCXXNestedNameSpecifier(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, clang::SourceLocation, bool) (/usr/local/bin/clang-15+0x4d5f527)
#18 0x0000000004c6b940 clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo**, bool, bool) (/usr/local/bin/clang-15+0x4c6b940)
#19 0x0000000004bf53b8 clang::Parser::TryAnnotateTypeOrScopeToken() (/usr/local/bin/clang-15+0x4bf53b8)
#20 0x0000000004c1bb16 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/usr/local/bin/clang-15+0x4c1bb16)
#21 0x0000000004c1ebe1 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/usr/local/bin/clang-15+0x4c1ebe1)
#22 0x0000000004c1f013 clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/usr/local/bin/clang-15+0x4c1f013)
#23 0x0000000004c39093 clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/usr/local/bin/clang-15+0x4c39093)
#24 0x0000000004c4028a clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/local/bin/clang-15+0x4c4028a)
#25 0x0000000004c46909 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/usr/local/bin/clang-15+0x4c46909)
#26 0x0000000004c48b0c clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::ParsedAttributes&, clang::TypeSpecifierType, clang::Decl*) (/usr/local/bin/clang-15+0x4c48b0c)
#27 0x0000000004c48efc clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/usr/local/bin/clang-15+0x4c48efc)
#28 0x0000000004c4b32c clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/usr/local/bin/clang-15+0x4c4b32c)
#29 0x0000000004c1b11b clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/usr/local/bin/clang-15+0x4c1b11b)
#30 0x0000000004cdd78e clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/local/bin/clang-15+0x4cdd78e)
#31 0x0000000004ce5a7d clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/local/bin/clang-15+0x4ce5a7d)
#32 0x0000000004ce5ca7 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/local/bin/clang-15+0x4ce5ca7)
#33 0x0000000004c29953 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/local/bin/clang-15+0x4c29953)
#34 0x0000000004bfde6b clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/local/bin/clang-15+0x4bfde6b)
#35 0x0000000004bff68a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/local/bin/clang-15+0x4bff68a)
#36 0x0000000004bf113a clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang-15+0x4bf113a)
#37 0x0000000003a3e559 clang::FrontendAction::Execute() (/usr/local/bin/clang-15+0x3a3e559)
#38 0x00000000039c9e6b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang-15+0x39c9e6b)
#39 0x0000000003af4743 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/bin/clang-15+0x3af4743)
#40 0x0000000000a6559d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/bin/clang-15+0xa6559d)
#41 0x0000000000a5f13c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#42 0x000000000383f345 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
#43 0x0000000002f11393 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local/bin/clang-15+0x2f11393)
#44 0x000000000383f6d9 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.0) Job.cpp:0:0
#45 0x000000000380c576 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/local/bin/clang-15+0x380c576)
#46 0x000000000380cf6d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/usr/local/bin/clang-15+0x380cf6d)
#47 0x000000000381ca3c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/local/bin/clang-15+0x381ca3c)
#48 0x0000000000a634dd clang_main(int, char**) (/usr/local/bin/clang-15+0xa634dd)
#49 0x00007fd08f05234a __libc_start_main (/lib64/libc.so.6+0x2434a)
#50 0x0000000000a5e66a _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:122:0
clang-15: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 15.0.2
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-15: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-15: note: diagnostic msg: /tmp/t-0154b2.cpp
clang-15: note: diagnostic msg: /tmp/t-0154b2.sh
clang-15: note: diagnostic msg: 

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

t.zip

@EugeneZelenko EugeneZelenko added c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Nov 13, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 13, 2022

@llvm/issue-subscribers-clang-frontend

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 13, 2022

@llvm/issue-subscribers-c-20

@shafik
Copy link
Collaborator

shafik commented Nov 13, 2022

It looks like this is fixed in trunk: https://godbolt.org/z/vT75zY98G

So I will close this, if you feel I am missing something feel free to reopen.

@shafik shafik closed this as completed Nov 13, 2022
@shafik
Copy link
Collaborator

shafik commented Nov 14, 2022

Looks related to: #54358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants