1// Make sure symbolization works even if the path to the .exe file changes.
2// RUN: mkdir %t || true
3// RUN: %clang_cl_asan -O0 %s -Fe%t/symbols_path.exe
4// RUN: not %run %t/symbols_path.exe 2>&1 | FileCheck %s
5// RUN: mkdir %t2 || true
6// RUN: mv %t/* %t2
7// RUN: not %run %t2/symbols_path.exe 2>&1 | FileCheck %s
8
9#include <malloc.h>
10
11int main() {
12  char *buffer = (char*)malloc(42);
13  buffer[-1] = 42;
14// CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
15// CHECK: WRITE of size 1 at [[ADDR]] thread T0
16// CHECK-NEXT: {{#0 .* main .*symbols_path.cc}}:[[@LINE-3]]
17// CHECK: [[ADDR]] is located 1 bytes to the left of 42-byte region
18// CHECK: allocated by thread T0 here:
19// CHECK-NEXT: {{#0 .* malloc }}
20// CHECK-NEXT: {{#1 .* main .*symbols_path.cc}}:[[@LINE-8]]
21  free(buffer);
22}
23