llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> Shouldn't happen, but does. Fixes #<!-- -->155147 --- Full diff: https://github.com/llvm/llvm-project/pull/155151.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+5) - (modified) clang/test/AST/ByteCode/c.c (+9) ``````````diff diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index e3235d34e230e..efd4efad5733a 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -5230,6 +5230,11 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) { return false; assert(HasRVO == Func->hasRVO()); + // This should already be checked in sema, but in error cases it might still + // happen. + if (Args.size() < Func->getNumWrittenParams()) + return false; + bool HasQualifier = false; if (const auto *ME = dyn_cast<MemberExpr>(E->getCallee())) HasQualifier = ME->hasQualifier(); diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c index 73469d7fd6cc4..113cc75bd0098 100644 --- a/clang/test/AST/ByteCode/c.c +++ b/clang/test/AST/ByteCode/c.c @@ -347,3 +347,12 @@ 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 apple(x) // all-error{{parameter 'x' was not declared}} \ + // all-warning {{a function definition without a prototype}} +void pear() { // all-error {{parameter named}} \ + // all-error {{expected ';'}} \ + // pedantic-warning {{a function declaration without a prototype}} + x = apple(); +} + `````````` </details> https://github.com/llvm/llvm-project/pull/155151 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits