Skip to content

Commit 79566b2

Browse files
[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]
1 parent eb88c04 commit 79566b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ TEST(AddressSanitizer, ReallocTest) {
395395
}
396396
free(ptr);
397397
// Realloc pointer returned by malloc(0).
398+
#pragma clang diagnostic push
399+
#pragma clang diagnostic ignored "-Walloc-size"
398400
int *ptr2 = Ident((int*)malloc(0));
401+
#pragma clang diagnostic pop
399402
ptr2 = Ident((int*)realloc(ptr2, sizeof(*ptr2)));
400403
*ptr2 = 42;
401404
EXPECT_EQ(42, *ptr2);

0 commit comments

Comments
 (0)