forked from OSchip/llvm-project
PR5462: Don't run off the edge of the argument array for vararg handling
when there are more parameters in the prototype than arguments to the call. llvm-svn: 88759
This commit is contained in:
parent
6c39d457fa
commit
a9ea959d04
|
@ -2679,7 +2679,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
|
||||||
CallType = VariadicMethod;
|
CallType = VariadicMethod;
|
||||||
|
|
||||||
// Promote the arguments (C99 6.5.2.2p7).
|
// Promote the arguments (C99 6.5.2.2p7).
|
||||||
for (unsigned i = NumArgsInProto; i != NumArgs; i++) {
|
for (unsigned i = NumArgsInProto; i < NumArgs; i++) {
|
||||||
Expr *Arg = Args[i];
|
Expr *Arg = Args[i];
|
||||||
Invalid |= DefaultVariadicArgumentPromotion(Arg, CallType);
|
Invalid |= DefaultVariadicArgumentPromotion(Arg, CallType);
|
||||||
Call->setArg(i, Arg);
|
Call->setArg(i, Arg);
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// RUN: clang-cc %s -verify -fsyntax-only
|
||||||
|
// PR5462
|
||||||
|
|
||||||
|
void f1(void);
|
||||||
|
void f2(const char * = __null, ...);
|
||||||
|
|
||||||
|
void f1(void)
|
||||||
|
{
|
||||||
|
f2();
|
||||||
|
}
|
Loading…
Reference in New Issue