[llvm-commits] [llvm] r50372 - /llvm/trunk/lib/Support/Allocator.cpp

Dan Gohman gohman at apple.com
Mon Apr 28 13:25:15 PDT 2008


Author: djg
Date: Mon Apr 28 15:25:15 2008
New Revision: 50372

URL: http://llvm.org/viewvc/llvm-project?rev=50372&view=rev
Log:
Fix a pointer-arithmetic bug that caused 64-bit host pointer values to
be truncated to 32 bits. This fixes the recent Benchmarks/McCat/09-vor
regression on x86-64, among other things.

Modified:
    llvm/trunk/lib/Support/Allocator.cpp

Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=50372&r1=50371&r2=50372&view=diff

==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Mon Apr 28 15:25:15 2008
@@ -48,7 +48,7 @@
   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;





More information about the llvm-commits mailing list