1 | // If we have LLD, see that things more or less work. |
2 | // |
3 | // REQUIRES: lld-available |
4 | // |
5 | // RUN: %clangxx_asan -O2 %s -o %t.exe -g -gcodeview -fuse-ld=lld -Wl,-debug |
6 | // RUN: not %run %t.exe 2>&1 | FileCheck %s |
7 | |
8 | #include <stdlib.h> |
9 | |
10 | int main() { |
11 | char *x = (char*)malloc(size: 10 * sizeof(char)); |
12 | free(ptr: x); |
13 | return x[5]; |
14 | // CHECK: heap-use-after-free |
15 | // CHECK: free |
16 | // CHECK: main{{.*}}fuse-lld.cpp:[[@LINE-4]]:3 |
17 | // CHECK: malloc |
18 | // CHECK: main{{.*}}fuse-lld.cpp:[[@LINE-7]]:20 |
19 | } |
20 | |