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

Compiler crashes on partial specialization of variable template with template template parameter #34301

Closed
insertinterestingnamehere opened this issue Oct 15, 2017 · 8 comments
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-invalid

Comments

@insertinterestingnamehere
Copy link

insertinterestingnamehere commented Oct 15, 2017

Bugzilla Link 34953
Version trunk
OS All
CC @DougGregor,@insertinterestingnamehere

Extended Description

This template is valid, and does compile with clang 3.9 and clang 5.0, but not with clang 4 or trunk. Trunk crashes, and clang 4 gives an error.
See also https://godbolt.org/g/NGQNCm.
Second similar example with structs further down.
To the best of my knowledge, both examples should be fine.

template <typename... param_types>
struct is_specified_instantiation_of {
  template <typename T, template <param_types...> class container>
  static constexpr bool value = false;

  template <template <param_types...> class container, param_types... params>
  static constexpr bool value<container<params...>, container> = true;

};

template <bool...>
struct bool_sequence {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template 
    value<bool_sequence<true, false>, bool_sequence>, "");
}

A related example that compiles with 3.8 but either fails or crashes with later (crashes with trunk, see also https://godbolt.org/g/ZyTERb)

template <typename... param_types>
struct is_specified_instantiation_of {
  template <typename T, template <param_types...> class container>
  struct val {
    static constexpr bool value = false;
  };

  template <template <param_types...> class container, param_types... params>
  struct val<container<params...>, container> {
    static constexpr bool value = true;
  };
};

template <bool...>
struct bool_sequence {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template 
    val<bool_sequence<true, false>, bool_sequence>::value, "");
}
@insertinterestingnamehere
Copy link
Author

insertinterestingnamehere commented Oct 16, 2017

Here's a very slightly refined version of the first test case. It appears that swapping the order in which the template parameters are passed to the variable template is what causes the crash. The following works fine.

template <typename... param_types>
struct is_specified_instantiation_of {
  template <template <param_types...> class container, typename T>
  static constexpr bool value = false;

  template <template <param_types...> class container, param_types... params>
  static constexpr bool value<container, container<params...>> = true;

};

template <bool, bool>
struct bool_pair {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template value<bool_pair, bool_pair<true, false>>, "");
}

Whereas the following crashes with trunk

template <typename... param_types>
struct is_specified_instantiation_of {
  template <typename T, template <param_types...> class container>
  static constexpr bool value = false;

  template <template <param_types...> class container, param_types... params>
  static constexpr bool value<container<params...>, container> = true;

};

template <bool, bool>
struct bool_pair {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template
    value<bool_pair<true, false>, bool_pair>, "");
}

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@wheatman
Copy link
Contributor

This still reproduces on post 16 trunk (12e9c7a)
The assert triggered is

clang++: /root/llvm-project/clang/include/clang/AST/TemplateBase.h:399: 
unsigned int clang::TemplateArgument::pack_size() const: Assertion `getKind() == Pack' failed.

The code is

template <typename... param_types>
struct is_specified_instantiation_of {
  template <typename T, template <param_types...> class container>
  static constexpr bool value = false;

  template <template <param_types...> class container, param_types... params>
  static constexpr bool value<container<params...>, container> = true;

};

template <bool, bool>
struct bool_pair {};

int main () {
  static_assert(is_specified_instantiation_of<bool, bool>::template
    value<bool_pair<true, false>, bool_pair>, "");
}

The full backtrace is

clang++: /root/llvm-project/clang/include/clang/AST/TemplateBase.h:399: unsigned int clang::TemplateArgument::pack_size() const: Assertion `getKind() == Pack' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++14 <source>
1.	<source>:7:64: current parser token '='
2.	<source>:2:1: parsing struct/union/class body 'is_specified_instantiation_of'
 #0 0x000055c170d02f1f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c55f1f)
 #1 0x000055c170d00c8c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c53c8c)
 #2 0x000055c170c4b518 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fabddba1420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fabdd66e00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007fabdd64d859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007fabdd64d729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007fabdd65efd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055c174061aa2 clang::Sema::CheckParameterPacksForExpansion(clang::SourceLocation, clang::SourceRange, llvm::ArrayRef<std::pair<llvm::PointerUnion<clang::TemplateTypeParmType const*, clang::NamedDecl*>, clang::SourceLocation>>, clang::MultiLevelTemplateArgumentList const&, bool&, bool&, std::optional<unsigned int>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fb4aa2)
 #9 0x000055c174007b6d clang::TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(clang::NonTypeTemplateParmDecl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f5ab6d)
#10 0x000055c1740561e8 clang::TemplateDeclInstantiator::SubstTemplateParams(clang::TemplateParameterList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fa91e8)
#11 0x000055c174057983 clang::Sema::SubstTemplateParams(clang::TemplateParameterList*, clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6faa983)
#12 0x000055c173e62eaa clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::TemplateArgumentLoc&, clang::NamedDecl*, clang::SourceLocation, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, clang::Sema::CheckTemplateArgumentKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6db5eaa)
#13 0x000055c173e657f1 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6db87f1)
#14 0x000055c173f0ac1c clang::Sema::ActOnVarTemplateSpecialization(clang::Scope*, clang::Declarator&, clang::TypeSourceInfo*, clang::SourceLocation, clang::TemplateParameterList*, clang::StorageClass, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e5dc1c)
#15 0x000055c1737e068d clang::Sema::ActOnVariableDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&, llvm::ArrayRef<clang::BindingDecl*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x673368d)
#16 0x000055c1737fa997 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x674d997)
#17 0x000055c1738c8ca1 clang::Sema::ActOnCXXMemberDeclarator(clang::Scope*, clang::AccessSpecifier, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Expr*, clang::VirtSpecifiers const&, clang::InClassInitStyle) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x681bca1)
#18 0x000055c1734d2324 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6425324)
#19 0x000055c173576ac5 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64c9ac5)
#20 0x000055c17357ca26 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#21 0x000055c1734d1abb clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6424abb)
#22 0x000055c1734d3c75 clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::ParsedAttributes&, clang::TypeSpecifierType, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6426c75)
#23 0x000055c1734d568d clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x642868d)
#24 0x000055c1734d7878 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x642a878)
#25 0x000055c1734b055d clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x640355d)
#26 0x000055c173576252 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64c9252)
#27 0x000055c17357ca26 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (.part.0) ParseTemplate.cpp:0:0
#28 0x000055c17357cca3 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64cfca3)
#29 0x000055c1734b713e clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x640a13e)
#30 0x000055c173482354 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63d5354)
#31 0x000055c173483296 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63d6296)
#32 0x000055c173483734 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63d6734)
#33 0x000055c17347700a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63ca00a)
#34 0x000055c171f7ba48 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ecea48)
#35 0x000055c1717c5a59 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4718a59)
#36 0x000055c17174b3a6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x469e3a6)
#37 0x000055c1718aa206 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47fd206)
#38 0x000055c16e1a30cd cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10f60cd)
#39 0x000055c16e19edca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#40 0x000055c1715aa11d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#41 0x000055c170c4ba20 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b9ea20)
#42 0x000055c1715aa73f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#43 0x000055c1715718cc clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c48cc)
#44 0x000055c17157235d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c535d)
#45 0x000055c17157a43d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44cd43d)
#46 0x000055c16e1a132a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10f432a)
#47 0x000055c16e0a75a5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xffa5a5)
#48 0x00007fabdd64f083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#49 0x000055c16e199bae _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10ecbae)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] labels Jun 28, 2023
@llvmbot
Copy link
Member

llvmbot commented Jun 28, 2023

@llvm/issue-subscribers-clang-frontend

@Endilll Endilll added crash-on-invalid and removed crash Prefer [crash-on-valid] or [crash-on-invalid] labels Jun 29, 2023
@Endilll
Copy link
Contributor

Endilll commented Jun 29, 2023

@Endilll Endilll added the confirmed Verified by a second party label Jun 29, 2023
@Endilll
Copy link
Contributor

Endilll commented Aug 10, 2024

I ran into the same assertion while reducing #77250 (https://godbolt.org/z/sxeoj751E):

auto __make_tuple = []<class... _Captures >(_Captures...) {
  return []< class _Fun >( _Fun) -> void
           requires requires { 0; }
  {};
};

template < class, class _As >
using __call_result_t = decltype(__make_tuple(0)(_As{}));

using T = __call_result_t< int, int >;

Clang 20.0 crash:

clang++: /root/llvm-project/clang/include/clang/AST/TemplateBase.h:439:
unsigned int clang::TemplateArgument::pack_size() const:
Assertion `getKind() == Pack' failed.

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++20 <source>
1.	<source>:10:11: at annotation token
 #0 0x0000000003abe608 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3abe608)
 #1 0x0000000003abc2fc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3abc2fc)
 #2 0x0000000003a052f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007cc450442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007cc4504969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007cc450442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007cc4504287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007cc45042871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007cc450439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x000000000720b923 clang::Sema::getNumArgumentsInExpansionFromUnexpanded(llvm::ArrayRef<std::pair<llvm::PointerUnion<clang::TemplateTypeParmType const*, clang::NamedDecl*>, clang::SourceLocation>>, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x720b923)
#10 0x000000000721b17d clang::Sema::getNumArgumentsInExpansion(clang::QualType, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x721b17d)
#11 0x00000000071aed5c clang::Sema::addInstantiatedParametersToScope(clang::FunctionDecl*, clang::FunctionDecl const*, clang::LocalInstantiationScope&, clang::MultiLevelTemplateArgumentList const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71aed5c)
#12 0x0000000006ce50b6 clang::Sema::LambdaScopeForCallOperatorInstantiationRAII::LambdaScopeForCallOperatorInstantiationRAII(clang::Sema&, clang::FunctionDecl*, clang::MultiLevelTemplateArgumentList, clang::LocalInstantiationScope&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ce50b6)
#13 0x00000000067bd4ae clang::Sema::CheckInstantiatedFunctionTemplateConstraints(clang::SourceLocation, clang::FunctionDecl*, llvm::ArrayRef<clang::TemplateArgument>, clang::ConstraintSatisfaction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67bd4ae)
#14 0x00000000070a6702 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 ()>) (.constprop.0) SemaTemplateDeduction.cpp:0:0
#15 0x00000000070a710a void llvm::function_ref<void ()>::callback_fn<clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>)::'lambda1'()>(long) SemaTemplateDeduction.cpp:0:0
#16 0x0000000006640431 clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6640431)
#17 0x00000000070b2212 clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x70b2212)
#18 0x0000000006ec639d 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) (.constprop.0) SemaOverload.cpp:0:0
#19 0x0000000006ec6d21 clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, clang::OverloadCandidateParamOrder) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ec6d21)
#20 0x0000000006ed72e2 clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ed72e2)
#21 0x0000000006ac4ccd clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ac4ccd)
#22 0x0000000006ac6cec clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6ac6cec)
#23 0x0000000007169920 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) SemaTemplateInstantiate.cpp:0:0
#24 0x000000000715d445 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) SemaTemplateInstantiate.cpp:0:0
#25 0x000000000716e047 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&, clang::TypeLoc) SemaTemplateInstantiate.cpp:0:0
#26 0x00000000071749fa clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*) SemaTemplateInstantiate.cpp:0:0
#27 0x0000000007174b1c clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformType(clang::QualType) SemaTemplateInstantiate.cpp:0:0
#28 0x00000000071767db clang::Sema::SubstType(clang::QualType, clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation, clang::DeclarationName) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71767db)
#29 0x0000000006fad6e6 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fad6e6)
#30 0x0000000006fafaa7 clang::Sema::ActOnTemplateIdType(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo const*, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, bool, bool, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6fafaa7)
#31 0x00000000065d9e4b clang::Parser::AnnotateTemplateIdTokenAsType(clang::CXXScopeSpec&, clang::ImplicitTypenameContext, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65d9e4b)
#32 0x0000000006515492 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6515492)
#33 0x0000000006518212 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6518212)
#34 0x000000000651f1f0 clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651f1f0)
#35 0x000000000652cb59 clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652cb59)
#36 0x000000000653664e clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x653664e)
#37 0x00000000065373a5 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65373a5)
#38 0x000000000651bbdf clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x651bbdf)
#39 0x00000000064d89e1 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64d89e1)
#40 0x00000000064d986d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64d986d)
#41 0x00000000064ccd3a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64ccd3a)
#42 0x00000000043d11d8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43d11d8)
#43 0x000000000465d109 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x465d109)
#44 0x00000000045e170e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45e170e)
#45 0x00000000047465de clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47465de)
#46 0x0000000000c9299f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc9299f)
#47 0x0000000000c8bb2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#48 0x0000000004414819 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#49 0x0000000003a057a4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a057a4)
#50 0x0000000004414e0f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#51 0x00000000043da9d5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43da9d5)
#52 0x00000000043db43d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43db43d)
#53 0x00000000043e3055 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x43e3055)
#54 0x0000000000c8fcd5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc8fcd5)
#55 0x0000000000b63ba4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb63ba4)
#56 0x00007cc450429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#57 0x00007cc450429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#58 0x0000000000c8b5de _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc8b5de)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@shafik
Copy link
Collaborator

shafik commented Aug 10, 2024

@Endilll the new reduction looks like a regression: https://godbolt.org/z/Wj9zeKd8c

@Endilll
Copy link
Contributor

Endilll commented Aug 10, 2024

I bisected the new reduction to 843cc47 (#82310)
CC @zyn0217 as an author.

@hubert-reinterpretcast
Copy link
Collaborator

I believe this is passing on 19.1.0 and trunk now: https://godbolt.org/z/bf8MjG5Yj

@shafik shafik closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-invalid
Projects
None yet
Development

No branches or pull requests

7 participants