[compiler-rt] 79566b2 - [compiler-rt] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 10:33:59 PDT 2025


Author: Kazu Hirata
Date: 2025-08-26T10:33:53-07:00
New Revision: 79566b2e831c605a8457e5f517b2375f1afa56a4

URL: https://github.com/llvm/llvm-project/commit/79566b2e831c605a8457e5f517b2375f1afa56a4
DIFF: https://github.com/llvm/llvm-project/commit/79566b2e831c605a8457e5f517b2375f1afa56a4.diff

LOG: [compiler-rt] Fix a warning

This patch fixes:

  compiler-rt/lib/asan/tests/asan_test.cpp:398:27: error: allocation
  of insufficient size '0' for type 'int' with size '4'
  [-Werror,-Walloc-size]

Added: 
    

Modified: 
    compiler-rt/lib/asan/tests/asan_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/tests/asan_test.cpp b/compiler-rt/lib/asan/tests/asan_test.cpp
index 2d054ee859ed4..85ed3c6769339 100644
--- a/compiler-rt/lib/asan/tests/asan_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_test.cpp
@@ -395,7 +395,10 @@ TEST(AddressSanitizer, ReallocTest) {
   }
   free(ptr);
   // Realloc pointer returned by malloc(0).
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Walloc-size"
   int *ptr2 = Ident((int*)malloc(0));
+#pragma clang diagnostic pop
   ptr2 = Ident((int*)realloc(ptr2, sizeof(*ptr2)));
   *ptr2 = 42;
   EXPECT_EQ(42, *ptr2);


        


More information about the llvm-commits mailing list