[llvm-commits] [dragonegg] r128824 - /dragonegg/trunk/Convert.cpp
Duncan Sands
baldrick at free.fr
Mon Apr 4 09:48:17 PDT 2011
Author: baldrick
Date: Mon Apr 4 11:48:17 2011
New Revision: 128824
URL: http://llvm.org/viewvc/llvm-project?rev=128824&view=rev
Log:
Fix another class of Fortran failures: when passing 2D arrays with
unknown size two parameters are declared: a pointer to the array
and an integer holding the stride. If the Fortran front-end knows
that the stride is not used then it doesn't bother to provide a
value for it in calls. As far as I can see GCC doesn't try to pass
anything special (like zero) in this case: the callee just gets some
random value. Emulate this by passing 'undef' for the missing call
argument(s).
Modified:
dragonegg/trunk/Convert.cpp
Modified: dragonegg/trunk/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Convert.cpp?rev=128824&r1=128823&r2=128824&view=diff
==============================================================================
--- dragonegg/trunk/Convert.cpp (original)
+++ dragonegg/trunk/Convert.cpp Mon Apr 4 11:48:17 2011
@@ -2871,6 +2871,15 @@
}
}
+ // Unlike LLVM, GCC does not require that call statements provide a value for
+ // every function argument (it passes rubbish for arguments with no value).
+ // To get the same effect we pass 'undef' for any unspecified arguments.
+ PFTy = cast<PointerType>(Callee->getType());
+ FTy = cast<FunctionType>(PFTy->getElementType());
+ if (CallOperands.size() < FTy->getNumParams())
+ for (unsigned i = CallOperands.size(), e = FTy->getNumParams(); i !=e; ++i)
+ CallOperands.push_back(UndefValue::get(FTy->getParamType(i)));
+
Value *Call;
if (!LandingPad) {
Call = Builder.CreateCall(Callee, CallOperands.begin(), CallOperands.end());
More information about the llvm-commits
mailing list