[llvm-commits] [llvm] r79494 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp
Reid Kleckner
reid at kleckner.net
Wed Aug 19 16:40:00 PDT 2009
Author: rnk
Date: Wed Aug 19 18:39:59 2009
New Revision: 79494
URL: http://llvm.org/viewvc/llvm-project?rev=79494&view=rev
Log:
Modify an assert to avoid what looks like a GCC 4.2.4 signed-ness bug.
Modified:
llvm/trunk/lib/Target/X86/X86JITInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=79494&r1=79493&r2=79494&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Wed Aug 19 18:39:59 2009
@@ -495,9 +495,11 @@
// complains about casting a function pointer to a normal pointer.
JCE.startGVStub(F, Stub, 5);
JCE.emitByte(0xE9);
-#if defined (X86_64_JIT)
- assert(((((intptr_t)Fn-JCE.getCurrentPCValue()-5) << 32) >> 32) ==
- ((intptr_t)Fn-JCE.getCurrentPCValue()-5)
+#if defined (X86_64_JIT) && !defined (NDEBUG)
+ // Yes, we need both of these casts, or some broken versions of GCC (4.2.4)
+ // get the signed-ness of the expression wrong. Go figure.
+ intptr_t Displacement = (intptr_t)Fn - (intptr_t)JCE.getCurrentPCValue() - 5;
+ assert(((Displacement << 32) >> 32) == Displacement
&& "PIC displacement does not fit in displacement field!");
#endif
JCE.emitWordLE((intptr_t)Fn-JCE.getCurrentPCValue()-4);
More information about the llvm-commits
mailing list