Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
authorDan Gohman <gohman@apple.com>
Mon, 28 Apr 2008 20:25:15 +0000 (20:25 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 28 Apr 2008 20:25:15 +0000 (20:25 +0000)
be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
regression on x86-64, among other things.

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

lib/Support/Allocator.cpp

index 8ccd3908446a4a47ecf96f49d49bdecb09bef673..4b6f9ff7b1330fc32df40c7dfce60d33a7b0cf33 100644 (file)
@@ -48,7 +48,7 @@ public:
   void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
     
     char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1)) 
-                            & ~(Alignment-1));
+                            & ~((uintptr_t) Alignment-1));
 
     // Speculate the new value of NextPtr.
     char* NextPtrTmp = Result + AllocSize;