llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[CodeGen] Assertion `paramInfos.size() <= totalArgs && "Did we forget to insert pass_object_size args?"' failed.

Open k-arrows opened this issue 6 months ago • 3 comments

Reproducer: https://godbolt.org/z/hjbhx4rzG

void foo(void (*fp)(void *__attribute__((pass_object_size(0))))) {
  int p[32];
  fp(p);
}

Backtrace:

clang++: /root/llvm-project/llvm/tools/clang/lib/CodeGen/CGCall.cpp:194: void addExtParameterInfosForCall(llvm::SmallVectorImpl<clang::FunctionType::ExtParameterInfo>&, const clang::FunctionProtoType*, unsigned int, unsigned int): Assertion `paramInfos.size() <= totalArgs && "Did we forget to insert pass_object_size args?"' 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++ -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 <source>
1.	<eof> parser at end of file
2.	<source>:1:6: LLVM IR generation of declaration 'foo'
3.	<source>:1:6: Generating code for declaration 'foo'
 #0 0x00000000045a2e38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45a2e38)
 #1 0x000000000459fc74 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x459fc74)
 #2 0x00000000045a0294 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45a0294)
 #3 0x00000000044dc7a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007f6a9a842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f6a9a8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #6 0x00007f6a9a842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #7 0x00007f6a9a8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #8 0x00007f6a9a82871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #9 0x00007f6a9a839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x0000000004fb9b49 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4fb9b49)
#11 0x0000000004fc5b30 arrangeFreeFunctionLikeCall(clang::CodeGen::CodeGenTypes&, clang::CodeGen::CodeGenModule&, clang::CodeGen::CallArgList const&, clang::FunctionType const*, unsigned int, bool) CGCall.cpp:0:0
#12 0x0000000004ab9444 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*, llvm::CallBase**, clang::CodeGen::CGFunctionInfo const**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ab9444)
#13 0x0000000004abaf4d clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4abaf4d)
#14 0x0000000004b2a182 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#15 0x0000000004b1f690 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#16 0x0000000004b2540c clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b2540c)
#17 0x0000000004a8255e clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a8255e)
#18 0x0000000004ab603d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ab603d)
#19 0x0000000004c4f1ff clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c4f1ff)
#20 0x0000000004c56f8b clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c56f8b)
#21 0x0000000004cc2ea6 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cc2ea6)
#22 0x0000000004cd75c4 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cd75c4)
#23 0x0000000004d48842 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d48842)
#24 0x0000000004d42e34 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d42e34)
#25 0x0000000004d43623 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d43623)
#26 0x0000000004d4ee83 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#27 0x00000000050dac89 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#28 0x00000000050cb0d4 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x50cb0d4)
#29 0x0000000006f55054 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f55054)
#30 0x00000000050d8a28 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x50d8a28)
#31 0x0000000005409e38 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5409e38)
#32 0x0000000005388868 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5388868)
#33 0x000000000550737d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x550737d)
#34 0x0000000000e0bfcb cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe0bfcb)
#35 0x0000000000e0292a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#36 0x0000000000e02aad int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#37 0x0000000005149f59 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
#38 0x00000000044dcbe4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44dcbe4)
#39 0x000000000514a5a6 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
#40 0x0000000005108622 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5108622)
#41 0x00000000051095ce 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+++0x51095ce)
#42 0x0000000005111285 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5111285)
#43 0x0000000000e08354 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe08354)
#44 0x0000000000caf64a main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcaf64a)
#45 0x00007f6a9a829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#46 0x00007f6a9a829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#47 0x0000000000e023c5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe023c5)

k-arrows avatar May 29 '26 12:05 k-arrows

Goes back to clang-5: https://godbolt.org/z/4PP5j7n9a

k-arrows avatar May 29 '26 12:05 k-arrows

@llvm/issue-subscribers-clang-codegen

Author: k-arrows

Reproducer: https://godbolt.org/z/hjbhx4rzG ```cpp void foo(void (*fp)(void *__attribute__((pass_object_size(0))))) { int p[32]; fp(p); } ```

Backtrace:

clang++: /root/llvm-project/llvm/tools/clang/lib/CodeGen/CGCall.cpp:194: void addExtParameterInfosForCall(llvm::SmallVectorImpl&lt;clang::FunctionType::ExtParameterInfo&gt;&amp;, const clang::FunctionProtoType*, unsigned int, unsigned int): Assertion `paramInfos.size() &lt;= totalArgs &amp;&amp; "Did we forget to insert pass_object_size args?"' 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++ -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 &lt;source&gt;
1.	&lt;eof&gt; parser at end of file
2.	&lt;source&gt;:1:6: LLVM IR generation of declaration 'foo'
3.	&lt;source&gt;:1:6: Generating code for declaration 'foo'
 #<!-- -->0 0x00000000045a2e38 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45a2e38)
 #<!-- -->1 0x000000000459fc74 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x459fc74)
 #<!-- -->2 0x00000000045a0294 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45a0294)
 #<!-- -->3 0x00000000044dc7a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #<!-- -->4 0x00007f6a9a842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->5 0x00007f6a9a8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #<!-- -->6 0x00007f6a9a842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->7 0x00007f6a9a8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->8 0x00007f6a9a82871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #<!-- -->9 0x00007f6a9a839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#<!-- -->10 0x0000000004fb9b49 (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4fb9b49)
#<!-- -->11 0x0000000004fc5b30 arrangeFreeFunctionLikeCall(clang::CodeGen::CodeGenTypes&amp;, clang::CodeGen::CodeGenModule&amp;, clang::CodeGen::CallArgList const&amp;, clang::FunctionType const*, unsigned int, bool) CGCall.cpp:0:0
#<!-- -->12 0x0000000004ab9444 clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, clang::CodeGen::CGCallee const&amp;, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::Value*, llvm::CallBase**, clang::CodeGen::CGFunctionInfo const**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ab9444)
#<!-- -->13 0x0000000004abaf4d clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4abaf4d)
#<!-- -->14 0x0000000004b2a182 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#<!-- -->15 0x0000000004b1f690 clang::StmtVisitorBase&lt;std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*&gt;::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#<!-- -->16 0x0000000004b2540c clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4b2540c)
#<!-- -->17 0x0000000004a8255e clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4a8255e)
#<!-- -->18 0x0000000004ab603d clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ab603d)
#<!-- -->19 0x0000000004c4f1ff clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef&lt;clang::Attr const*&gt;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c4f1ff)
#<!-- -->20 0x0000000004c56f8b clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&amp;, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c56f8b)
#<!-- -->21 0x0000000004cc2ea6 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cc2ea6)
#<!-- -->22 0x0000000004cd75c4 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4cd75c4)
#<!-- -->23 0x0000000004d48842 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d48842)
#<!-- -->24 0x0000000004d42e34 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d42e34)
#<!-- -->25 0x0000000004d43623 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d43623)
#<!-- -->26 0x0000000004d4ee83 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#<!-- -->27 0x00000000050dac89 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#<!-- -->28 0x00000000050cb0d4 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x50cb0d4)
#<!-- -->29 0x0000000006f55054 clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f55054)
#<!-- -->30 0x00000000050d8a28 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x50d8a28)
#<!-- -->31 0x0000000005409e38 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5409e38)
#<!-- -->32 0x0000000005388868 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5388868)
#<!-- -->33 0x000000000550737d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x550737d)
#<!-- -->34 0x0000000000e0bfcb cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe0bfcb)
#<!-- -->35 0x0000000000e0292a ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;, llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;) driver.cpp:0:0
#<!-- -->36 0x0000000000e02aad int llvm::function_ref&lt;int (llvm::SmallVectorImpl&lt;char const*&gt;&amp;)&gt;::callback_fn&lt;clang_main(int, char**, llvm::ToolContext const&amp;)::'lambda'(llvm::SmallVectorImpl&lt;char const*&gt;&amp;)&gt;(long, llvm::SmallVectorImpl&lt;char const*&gt;&amp;) driver.cpp:0:0
#<!-- -->37 0x0000000005149f59 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->38 0x00000000044dcbe4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44dcbe4)
#<!-- -->39 0x000000000514a5a6 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->40 0x0000000005108622 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5108622)
#<!-- -->41 0x00000000051095ce clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x51095ce)
#<!-- -->42 0x0000000005111285 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5111285)
#<!-- -->43 0x0000000000e08354 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe08354)
#<!-- -->44 0x0000000000caf64a main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcaf64a)
#<!-- -->45 0x00007f6a9a829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->46 0x00007f6a9a829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->47 0x0000000000e023c5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe023c5)

I took a look intoCGCall.cpp and CGExpr.cpp. I think the problem is that the call to EmitCallArgs in CodeGenFunction::EmitCall passes a nullptr as the AC parameter, which causes the lambda MaybeEmitImplicitObjectSize to return early on the check if (!AC.hasFunctionDecl() || I >= AC.getNumParams()). This early return results in not adding the size_t argument and later causes the assertion to fail.

While it is possible to get PassObjectSizeAttr * like MaybeEmitImplicitObjectSize does using TypeLoc, I don’t think it is a good way to fix this, as we would potentially need to extract a DeclRefExpr from infinitely many combinations. Currently, I don’t see a way to get PassObjectSizeAttr * from the FunctionProtoType. A better fix would be to make FunctionProtoType save the necessary information needed by MaybeEmitImplicitObjectSize. Any thoughts on that?

heturing avatar Jun 14 '26 01:06 heturing