https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155151
>From 6e9e9659ce2014d56780de5ed67697753ee6ad70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Tue, 26 Aug 2025 05:53:58 +0200 Subject: [PATCH] Fixup --- clang/lib/AST/ByteCode/Compiler.cpp | 6 ++++++ clang/test/AST/ByteCode/c.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index c36cb644282d8..c5af7b8450ed7 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -5228,6 +5228,12 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) { const Function *Func = getFunction(FuncDecl); if (!Func) return false; + + // In error cases, the function may be called with fewer arguments than + // parameters. + if (E->getNumArgs() < Func->getNumWrittenParams()) + return false; + assert(HasRVO == Func->hasRVO()); bool HasQualifier = false; diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c index 73469d7fd6cc4..258891453a0dc 100644 --- a/clang/test/AST/ByteCode/c.c +++ b/clang/test/AST/ByteCode/c.c @@ -347,3 +347,14 @@ const int compared = strcmp(_str, (const char *)_str2); // all-error {{initializ const int compared2 = strcmp(strcmp, _str); // all-warning {{incompatible pointer types}} \ // all-error {{initializer element is not a compile-time constant}} + +int foo(x) // all-warning {{a function definition without a prototype is deprecated in all versions of C}} +int x; +{ + return x; +} + +void bar() { // pedantic-warning {{a function declaration without a prototype}} + int x; + x = foo(); // all-warning {{too few arguments}} +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits