[llvm-commits] [llvm] r78805 - /llvm/trunk/unittests/Support/AllocatorTest.cpp
Benjamin Kramer
benny.kra at googlemail.com
Wed Aug 12 05:31:03 PDT 2009
Author: d0k
Date: Wed Aug 12 07:31:02 2009
New Revision: 78805
URL: http://llvm.org/viewvc/llvm-project?rev=78805&view=rev
Log:
Fix unit test on FreeBSD. We need to make sure there is enough space to save the pointer even if the memory returned from malloc was already aligned.
Modified:
llvm/trunk/unittests/Support/AllocatorTest.cpp
Modified: llvm/trunk/unittests/Support/AllocatorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/AllocatorTest.cpp?rev=78805&r1=78804&r2=78805&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/AllocatorTest.cpp (original)
+++ llvm/trunk/unittests/Support/AllocatorTest.cpp Wed Aug 12 07:31:02 2009
@@ -108,7 +108,7 @@
void *MemBase = malloc(Size + Alignment - 1 + sizeof(void*));
// Make the slab.
- MemSlab *Slab = (MemSlab*)(((uintptr_t)MemBase + Alignment - 1) &
+ MemSlab *Slab = (MemSlab*)(((uintptr_t)MemBase+sizeof(void*)+Alignment-1) &
~(uintptr_t)(Alignment - 1));
Slab->Size = Size;
Slab->NextPtr = 0;
More information about the llvm-commits
mailing list