[CodeGen] Assertion `paramInfos.size() <= totalArgs && "Did we forget to insert pass_object_size args?"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer:
https://godbolt.org/z/hjbhx4rzG
```cpp
void foo(void (*fp)(void *__attribute__((pass_object_size(0))))) {
int p[32];
fp(p);
}
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/CodeGen/CGCall.cpp:194: void addExtParameterInfosForCall(llvm::SmallVectorImpl&, 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
1. parser at end of file
2. :1:6: LLVM IR generation of declaration 'foo'
3. :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::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) (/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*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xe0bfcb)
#35 0x0000000000e0292a ExecuteCC1Tool(llvm::SmallVectorImpl&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr) driver.cpp:0:0
#36 0x0000000000e02aad int llvm::function_ref&)>::callback_fn&)>(long, llvm::SmallVectorImpl&) driver.cpp:0:0
#37 0x0000000005149f59 void llvm::function_ref::callback_fn>, std::__cxx11::basic_string, std::allocator>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#38 0x00000000044dcbe4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44dcbe4)
#39 0x000000000514a5a6 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, 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>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x51095ce)
#42 0x0000000005111285 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/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)
```
Contributor guide
Assessment
This issue has not been assessed yet.