Debian Codegraph @

compiler-rt/test/hwasan/TestCases/secondary-tag-zero.c

raw
1 // Test that tagging of freed large region is 0, which is better for RSS usage.
2 // RUN: %clang_hwasan -mllvm -hwasan-globals=0 -mllvm -hwasan-instrument-stack=0 %s -o %t && %run %t 2>&1
3
4 #include <assert.h>
5 #include <stdlib.h>
6
7 #include <sanitizer/hwasan_interface.h>
8
9 const int kSize = 10000000;
10
11 void *p;
12 int main() {
13 for (int i = 0; i < 256; ++i) {
14 p = malloc(kSize);
15 assert(-1 == __hwasan_test_shadow(p, kSize));
16
17 free(p);
18 assert(-1 == __hwasan_test_shadow(__hwasan_tag_pointer(p, 0), kSize));
19 }
20 return 0;
21 }