[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 14 13:13:02 PST 2003


Changes in directory llvm/lib/Transforms/IPO:

FunctionResolution.cpp updated: 1.20 -> 1.21

---
Log message:

Fix a bug that cause a crash resolving questionable function calls


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.20 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.21
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.20	Thu Jan 30 16:38:44 2003
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp	Fri Feb 14 13:12:29 2003
@@ -49,8 +49,8 @@
   //
   BasicBlock::iterator BBI = CI;
   unsigned NumArgsToCopy = CI->getNumOperands()-1;
-  if (CI->getNumOperands()-1 != ParamTys.size() &&
-      !(CI->getNumOperands()-1 > ParamTys.size() &&
+  if (NumArgsToCopy != ParamTys.size() &&
+      !(NumArgsToCopy > ParamTys.size() &&
         Dest->getFunctionType()->isVarArg())) {
     std::cerr << "WARNING: Call arguments do not match expected number of"
               << " parameters.\n";
@@ -59,6 +59,8 @@
     std::cerr << "Function resolved to: ";
     WriteAsOperand(std::cerr, Dest);
     std::cerr << "\n";
+    if (NumArgsToCopy > ParamTys.size())
+      NumArgsToCopy = ParamTys.size();
   }
 
   std::vector<Value*> Params;





More information about the llvm-commits mailing list