Fix the logic in this assertion to properly validate the number
authorDan Gohman <gohman@apple.com>
Thu, 19 Feb 2009 02:55:18 +0000 (02:55 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 19 Feb 2009 02:55:18 +0000 (02:55 +0000)
of arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64999 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/JIT.cpp

index 0f98ddcabb32a33e20d16f26e207a136ceecf4e7..a611e82585cdf1ec93c9ae2f92186a09ac1587e7 100644 (file)
@@ -356,8 +356,9 @@ GenericValue JIT::runFunction(Function *F,
   const FunctionType *FTy = F->getFunctionType();
   const Type *RetTy = FTy->getReturnType();
 
-  assert((FTy->getNumParams() <= ArgValues.size() || FTy->isVarArg()) &&
-         "Too many arguments passed into function!");
+  assert((FTy->getNumParams() == ArgValues.size() ||
+          (FTy->isVarArg() && FTy->getNumParams() <= ArgValues.size())) &&
+         "Wrong number of arguments passed into function!");
   assert(FTy->getNumParams() == ArgValues.size() &&
          "This doesn't support passing arguments through varargs (yet)!");