[llvm-commits] [dragonegg] r143357 - /dragonegg/trunk/src/Convert.cpp
Duncan Sands
baldrick at free.fr
Mon Oct 31 13:07:09 PDT 2011
Author: baldrick
Date: Mon Oct 31 15:07:09 2011
New Revision: 143357
URL: http://llvm.org/viewvc/llvm-project?rev=143357&view=rev
Log:
Fix a compile failure on 483.xalancbmk, caused by a minor GCC bug:
what should be the same type in the caller and callee are two
different (but equivalent) types (and not just variants of each
other).
Modified:
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=143357&r1=143356&r2=143357&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Mon Oct 31 15:07:09 2011
@@ -2802,6 +2802,20 @@
Client.clear();
}
+ // If the caller and callee disagree about a parameter type but the difference
+ // is trivial, correct the type used by the caller.
+ for (unsigned i = 0, e = std::min((unsigned)CallOperands.size(),
+ FTy->getNumParams());
+ i != e; ++i) {
+ Type *ExpectedTy = FTy->getParamType(i);
+ Type *ActualTy = CallOperands[i]->getType();
+ if (ActualTy == ExpectedTy)
+ continue;
+ assert(isa<PointerType>(ActualTy) && isa<PointerType>(ExpectedTy) &&
+ "Type difference is not trivial!");
+ CallOperands[i] = Builder.CreateBitCast(CallOperands[i], ExpectedTy);
+ }
+
// 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.
More information about the llvm-commits
mailing list