1 // RUN: %clangxx_asan -O0 -DSIZE=10 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
2 // RUN: %clangxx_asan -O0 -DSIZE=10000000 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
3 // REQUIRES: stable-runtime
4 
5 #include <stdlib.h>
6 #include <sanitizer/asan_interface.h>
7 
8 void UPDATE(void *p) {
9   __asan_update_allocation_context(p);
10 }
11 
12 int main() {
13   char *x = (char*)malloc(SIZE * sizeof(char));
14   UPDATE(x);
15   free(x);
16   return x[5];
17   // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}
18   // CHECK: UPDATE
19 }
20