OSDN Git Service

BumpPtrAllocator: use uintptr_t when aligning addresses to avoid undefined behaviour
authorHans Wennborg <hans@hanshq.net>
Tue, 2 Sep 2014 21:51:35 +0000 (21:51 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 2 Sep 2014 21:51:35 +0000 (21:51 +0000)
commitd52e9a143f254be7ac1f2e648f3c3dbe278f4711
tree3df91238e9d6518c8b3578d2ed8131bbf4b61dfd
parent891198b358c79d9464bd40d94f5ba6249080741a
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216973 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Allocator.h
include/llvm/Support/MathExtras.h
unittests/Support/AllocatorTest.cpp