[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Windows / use_after_realloc.cpp
blob35947b3253857ca8d205a6cf21b26073958892ea
1 // RUN: %clang_cl_asan %Od %s %Fe%t
2 // RUN: not %run %t 2>&1 | FileCheck %s
4 #include <malloc.h>
6 int main() {
7 char *buffer = (char*)realloc(0, 32),
8 *stale = buffer;
9 buffer = (char*)realloc(buffer, 64);
10 // The 'stale' may now point to a free'd memory.
11 stale[0] = 42;
12 // CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]]
13 // CHECK: WRITE of size 1 at [[ADDR]] thread T0
14 // CHECK-NEXT: {{#0 .* main .*use_after_realloc.cpp}}:[[@LINE-3]]
15 // CHECK: [[ADDR]] is located 0 bytes inside of 32-byte region
16 // CHECK: freed by thread T0 here:
17 // CHECK-NEXT: {{#0 .* realloc }}
18 // CHECK: {{ #[1-3] .* main .*use_after_realloc.cpp}}:[[@LINE-9]]
19 // CHECK: previously allocated by thread T0 here:
20 // CHECK-NEXT: {{#0 .* realloc }}
21 // CHECK: {{ #[1-3] .* main .*use_after_realloc.cpp}}:[[@LINE-14]]
22 free(buffer);