aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-08-12 12:31:02 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-08-12 12:31:02 +0000
commit6d747bdde604a38049d3406154984bce0c3ff6a2 (patch)
treeb88a314be05b8544e923b78b06f4c2f22ce0f684 /unittests
parent5f0ce2b68bd4d07a9afa02fe1a744f4c98c6b17d (diff)
downloadexternal_llvm-6d747bdde604a38049d3406154984bce0c3ff6a2.zip
external_llvm-6d747bdde604a38049d3406154984bce0c3ff6a2.tar.gz
external_llvm-6d747bdde604a38049d3406154984bce0c3ff6a2.tar.bz2
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/AllocatorTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/unittests/Support/AllocatorTest.cpp b/unittests/Support/AllocatorTest.cpp
index 463760d..2a01f3a 100644
--- a/unittests/Support/AllocatorTest.cpp
+++ b/unittests/Support/AllocatorTest.cpp
@@ -108,7 +108,7 @@ public:
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;