Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / double-free.c
bloba0a4bc26e0f834d6deb57e471c617818e4576dbc
1 // RUN: %clang_hwasan %s -o %t && not %run %t 2>&1 | FileCheck %s
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <sanitizer/hwasan_interface.h>
7 int main() {
8 __hwasan_enable_allocator_tagging();
9 char * volatile x = (char*)malloc(40);
10 free(x);
11 free(x);
12 // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{[0x]+}}[[PC:.*]] on thread T{{[0-9]+}}
13 // CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem)
14 // CHECK: #0 {{[0x]+}}{{.*}}[[PC]]
15 // If we instrument using calls (default on x86), free is not the top frame
16 // of the fault. With TCO the free frame can be replaced with the interceptor.
17 // CHECK: in {{.*}}free
18 // CHECK: freed by thread {{.*}} here:
19 // CHECK: previously allocated by thread {{.*}} here:
20 // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes):
21 // CHECK: =>{{.*}}[[MEM_TAG]]
22 fprintf(stderr, "DONE\n");
23 __hwasan_disable_allocator_tagging();
24 // CHECK-NOT: DONE