[compiler-rt] e55fca6 - [test][sanitizer] Use both allocators in test
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 23:22:46 PDT 2023
Author: Vitaly Buka
Date: 2023-04-25T23:22:33-07:00
New Revision: e55fca6b055532d36c51fee37e658e9e1fd9e46e
URL: https://github.com/llvm/llvm-project/commit/e55fca6b055532d36c51fee37e658e9e1fd9e46e
DIFF: https://github.com/llvm/llvm-project/commit/e55fca6b055532d36c51fee37e658e9e1fd9e46e.diff
LOG: [test][sanitizer] Use both allocators in test
Added:
Modified:
compiler-rt/test/sanitizer_common/TestCases/Linux/malloc_usable_size.c
Removed:
################################################################################
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/malloc_usable_size.c b/compiler-rt/test/sanitizer_common/TestCases/Linux/malloc_usable_size.c
index c51ab73774eea..55a06b6ec5d0e 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/malloc_usable_size.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/malloc_usable_size.c
@@ -8,12 +8,20 @@
#include <sanitizer/allocator_interface.h>
#include <stdlib.h>
+void *p;
+
int main() {
assert(__sanitizer_get_allocated_size(NULL) == 0);
assert(malloc_usable_size(NULL) == 0);
- int size = 1234567;
- void *p = malloc(size);
+ int size = 1;
+ p = malloc(size);
+ assert(__sanitizer_get_allocated_size(p) == size);
+ assert(malloc_usable_size(p) == size);
+ free(p);
+
+ size = 1234567;
+ p = malloc(size);
assert(__sanitizer_get_allocated_size(p) == size);
assert(malloc_usable_size(p) == size);
free(p);
More information about the llvm-commits
mailing list