[llvm] 56ee5d9 - [Support] Fix asan AllocatorTest after ba0d50ad7ec66

Sam McCall via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 06:52:00 PDT 2022


Author: Sam McCall
Date: 2022-05-06T15:51:37+02:00
New Revision: 56ee5d9337fac7fcf9e755e75d85563d84d1b89c

URL: https://github.com/llvm/llvm-project/commit/56ee5d9337fac7fcf9e755e75d85563d84d1b89c
DIFF: https://github.com/llvm/llvm-project/commit/56ee5d9337fac7fcf9e755e75d85563d84d1b89c.diff

LOG: [Support] Fix asan AllocatorTest after ba0d50ad7ec66

We were counting the number of bytes allocated, but under asan there's
extra redzone bytes by default. Disable this.

Added: 
    

Modified: 
    llvm/unittests/Support/AllocatorTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/AllocatorTest.cpp b/llvm/unittests/Support/AllocatorTest.cpp
index 665d1b7e38f03..b361b0aa72529 100644
--- a/llvm/unittests/Support/AllocatorTest.cpp
+++ b/llvm/unittests/Support/AllocatorTest.cpp
@@ -105,6 +105,7 @@ TEST(AllocatorTest, TestAlignment) {
 // we end up creating a slab for it.
 TEST(AllocatorTest, TestZero) {
   BumpPtrAllocator Alloc;
+  Alloc.setRedZoneSize(0); // else our arithmetic is all off
   EXPECT_EQ(0u, Alloc.GetNumSlabs());
   EXPECT_EQ(0u, Alloc.getBytesAllocated());
 


        


More information about the llvm-commits mailing list