[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Windows / allocators_sanity.cpp
blobfde5b3723f0454efe8796ef89c25495a596e60e8
1 // RUN: %clang_cl_asan %Od %s %Fe%t
2 // RUN: %run %t | FileCheck %s
4 #include <malloc.h>
5 #include <stdio.h>
7 int main() {
8 int *p = (int*)malloc(1024 * sizeof(int));
9 p[512] = 0;
10 free(p);
12 p = (int*)malloc(128);
13 p = (int*)realloc(p, 2048 * sizeof(int));
14 p[1024] = 0;
15 free(p);
17 p = (int*)calloc(16, sizeof(int));
18 if (p[8] != 0)
19 return 1;
20 p[15]++;
21 if (16 * sizeof(int) != _msize(p))
22 return 2;
23 free(p);
25 p = new int;
26 *p = 42;
27 delete p;
29 p = new int[42];
30 p[15]++;
31 delete [] p;
33 printf("All ok\n");
34 // CHECK: All ok
36 return 0;