<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69084>69084</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: version 18: Assertion `getNumParams() == params.size() && "NumParams overflow!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wierton
</td>
</tr>
</table>
<pre>
Compiler Explorer: https://godbolt.org/z/oKME95avz
The bug triggering program:
```
#define A1(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9,
#define A2(x) A1(x##0) A1(x##1) A1(x##2) A1(x##3) A1(x##4) \
A1(x##5) A1(x##6) A1(x##7) A1(x##8) A1(x##9)
#define A3(x) A2(x##0) A2(x##1) A2(x##2) A2(x##3) A2(x##4) \
A2(x##5) A2(x##6) A2(x##7) A2(x##8) A2(x##9)
#define A4(x) A3(x##0) A3(x##1) A3(x##2) A3(x##3) A3(x##4) \
A3(x##5) A3(x##6) A3(x##7) A3(x##8) A3(x##9)
#define A5(x) A4(x##0) A4(x##1) A4(x##2) A4(x##3) A4(x##4) \
A4(x##5) A4(x##6) A4(x##7) A4(x##8) A4(x##9)
void f(A5(int p) int t) { ; }
```
The full stack dump:
```
clang: /root/llvm-project/clang/lib/AST/Type.cpp:3389: clang::FunctionProtoType::FunctionProtoType(clang::QualType, llvm::ArrayRef<clang::QualType>, clang::QualType, const clang::FunctionProtoType::ExtProtoInfo&): Assertion `getNumParams() == params.size() && "NumParams overflow!"' 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-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O0 <source>
1. <source>:11:25: current parser token '{'
#0 0x000000000372dd18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372dd18)
#1 0x000000000372b9dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x372b9dc)
#2 0x00000000036742f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f0916186420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f0915c4900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f0915c28859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f0915c28729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f0915c39fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000000007297828 clang::FunctionProtoType::FunctionProtoType(clang::QualType, llvm::ArrayRef<clang::QualType>, clang::QualType, clang::FunctionProtoType::ExtProtoInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7297828)
#9 0x0000000006d56592 clang::ASTContext::getFunctionTypeInternal(clang::QualType, llvm::ArrayRef<clang::QualType>, clang::FunctionProtoType::ExtProtoInfo const&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6d56592)
#10 0x0000000006aa0c6a GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
#11 0x0000000006aa54ea clang::Sema::GetTypeForDeclarator(clang::Declarator&, clang::Scope*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6aa54ea)
#12 0x0000000006210fde clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6210fde)
#13 0x000000000621201f clang::Sema::ActOnStartOfFunctionDef(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Sema::SkipBodyInfo*, clang::Sema::FnBodyKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x621201f)
#14 0x0000000005eaadfc clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5eaadfc)
#15 0x0000000005ed2bd8 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ed2bd8)
#16 0x0000000005e9fb3b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5e9fb3b)
#17 0x0000000005ea026f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#18 0x0000000005ea7c14 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ea7c14)
#19 0x0000000005ea843d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ea843d)
#20 0x0000000005ea8880 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5ea8880)
#21 0x0000000005e9b4b2 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5e9b4b2)
#22 0x00000000049982a8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49982a8)
#23 0x00000000041fc4f9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x41fc4f9)
#24 0x000000000417d9ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x417d9ce)
#25 0x00000000042db54e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x42db54e)
#26 0x0000000000bef0e6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbef0e6)
#27 0x0000000000be69aa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x0000000003fd9c19 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
#29 0x00000000036747a4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x36747a4)
#30 0x0000000003fda20f 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
#31 0x0000000003fa23d5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fa23d5)
#32 0x0000000003fa2e3d 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+0x3fa2e3d)
#33 0x0000000003faad65 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3faad65)
#34 0x0000000000bec58c clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbec58c)
#35 0x0000000000ae6751 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xae6751)
#36 0x00007f0915c2a083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#37 0x0000000000be648e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xbe648e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z4yjW_jXkhrJLAn1e5ELtxP32TM_b2XZqb11IIIeNDFpAaWd-_Rb6cASxk8yup3e3tqvjwggdnufhcM4RFtGa7wRj1yD-BOKbK9KZB6muf3CmjBRXpaTP1yu5b3nDFLw9tI1UTAFcwAdjWg1wAdAaoPVO0lI2ZinVDqD17wCt5a-_3eYxefodBDcgKIbP-wcGy24HjeK7HVNc7GCr5E6RvbU0DEyC8f_wFWHKai4YLEKAsgNAOTwAhAHCAUCrqR3O2mjWxrN2NGvHs3Yya6ezdjZr5wCtXgFCE6AJ2ojK7Qj9DuR3YL8jsh0gnmYMchDk8-uxf0Pid6R-R-Z35ADlrxjhIyPkM0I-I-QzQj4j9A4j5DNCPiPkM0I-I_QOo-jICPuMsM8I-4ywzwi_wwj7jLDPCPuMsM8Iv8MoPjKKfEaRzyjyGUU-o-gdRpHPKPIZRT6jyGcUnWTUfz5JTmENUNbT4sLA1t5iG6aHk36CAH-CIL05HR6OYaXumgZqQ6pHSLt9ey6eVA0ROxu_AForKQ1A66Z52i9aJf_GKvt1GIHWDS8BWhebe4DW988tW1attYpxltv7J0MAF-t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