summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/AllocatorTest.cpp
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
commit9ace8b57630b9dad61569a565cca003a35f81059 (patch)
tree401dcc7b62507a981e760d62f55444275cde5721 /llvm/unittests/Support/AllocatorTest.cpp
parent55d2f75f0cabef16199651e4f2c18276ea6d1ed9 (diff)
downloadbcm5719-llvm-9ace8b57630b9dad61569a565cca003a35f81059.tar.gz
bcm5719-llvm-9ace8b57630b9dad61569a565cca003a35f81059.zip
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.
llvm-svn: 78805
Diffstat (limited to 'llvm/unittests/Support/AllocatorTest.cpp')
-rw-r--r--llvm/unittests/Support/AllocatorTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/unittests/Support/AllocatorTest.cpp b/llvm/unittests/Support/AllocatorTest.cpp
index 463760d2f0e..2a01f3a9c48 100644
--- a/llvm/unittests/Support/AllocatorTest.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud