summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/AllocatorTest.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-09-02 21:51:35 +0000
committerHans Wennborg <hans@hanshq.net>2014-09-02 21:51:35 +0000
commit3b84f59b6bdf4ce57767aae4825788dba04e106f (patch)
tree88ce1aa019e3fbb9f0808fa5b2e2a1cce7155663 /llvm/unittests/Support/AllocatorTest.cpp
parentad23852ac3cd606501aab5bd39a7ee59c07453c4 (diff)
downloadbcm5719-llvm-3b84f59b6bdf4ce57767aae4825788dba04e106f.tar.gz
bcm5719-llvm-3b84f59b6bdf4ce57767aae4825788dba04e106f.zip
BumpPtrAllocator: use uintptr_t when aligning addresses to avoid undefined behaviour
In theory, alignPtr() could push a pointer beyond the end of the current slab, making comparisons with that pointer undefined behaviour. Use an integer type to avoid this. llvm-svn: 216973
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 dc224925fdd..7789df5dc6f 100644
--- a/llvm/unittests/Support/AllocatorTest.cpp
+++ b/llvm/unittests/Support/AllocatorTest.cpp
@@ -130,7 +130,7 @@ public:
void *MemBase = malloc(Size + Alignment - 1 + sizeof(void*));
// Find the slab start.
- void *Slab = alignPtr((char *)MemBase + sizeof(void *), Alignment);
+ void *Slab = (void *)alignAddr((char*)MemBase + sizeof(void *), Alignment);
// Hold a pointer to the base so we can free the whole malloced block.
((void**)Slab)[-1] = MemBase;
OpenPOWER on IntegriCloud