Skip to content

Commit 5953e07

Browse files
authored
[NFC][Asan] Fix warning in test (llvm#155447)
After llvm#150028. Warning: ``` asan_test.cpp:398:27: error: allocation of insufficient size '0' for type 'int' with size '4' ```
1 parent 5088795 commit 5953e07

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,8 @@ 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"
400-
int *ptr2 = Ident((int*)malloc(0));
401-
#pragma clang diagnostic pop
398+
volatile void *ptr0 = malloc(0);
399+
int *ptr2 = Ident((int *)ptr0);
402400
ptr2 = Ident((int*)realloc(ptr2, sizeof(*ptr2)));
403401
*ptr2 = 42;
404402
EXPECT_EQ(42, *ptr2);

0 commit comments

Comments
 (0)