1 // If we have LLD, see that things more or less work.
2 //
3 // REQUIRES: lld
4 //
5 // FIXME: Use -fuse-ld=lld after the old COFF linker is removed.
6 // FIXME: Test will fail until we add flags for requesting dwarf or cv.
7 // RUNX: %clangxx_asan -O2 %s -o %t.exe -fuse-ld=lld -Wl,-debug
8 // RUN: %clangxx_asan -c -O2 %s -o %t.o -gdwarf
9 // RUN: lld-link %t.o -out:%t.exe -debug -defaultlib:libcmt %asan_lib %asan_cxx_lib
10 // RUN: not %run %t.exe 2>&1 | FileCheck %s
11 
12 #include <stdlib.h>
13 
main()14 int main() {
15   char *x = (char*)malloc(10 * sizeof(char));
16   free(x);
17   return x[5];
18   // CHECK: heap-use-after-free
19   // CHECK: free
20   // CHECK: main{{.*}}fuse-lld.cc:[[@LINE-4]]:3
21   // CHECK: malloc
22   // CHECK: main{{.*}}fuse-lld.cc:[[@LINE-7]]:20
23 }
24