]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Sanity checking a test in pure C. |
2 | // RUN: %clang_asan -O2 %s -o %t | |
3 | // RUN: not %run %t 2>&1 | FileCheck %s | |
4 | ||
5 | // Sanity checking a test in pure C with -pie. | |
7cac9316 | 6 | // RUN: %clang_asan -O2 %s %pie %fPIE -o %t |
1a4d82fc | 7 | // RUN: not %run %t 2>&1 | FileCheck %s |
7cac9316 | 8 | // REQUIRES: stable-runtime |
1a4d82fc JJ |
9 | |
10 | #include <stdlib.h> | |
11 | int main() { | |
12 | char *x = (char*)malloc(10 * sizeof(char)); | |
13 | free(x); | |
14 | return x[5]; | |
15 | // CHECK: heap-use-after-free | |
16 | // CHECK: free | |
17 | // CHECK: main{{.*}}sanity_check_pure_c.c:[[@LINE-4]] | |
18 | // CHECK: malloc | |
19 | // CHECK: main{{.*}}sanity_check_pure_c.c:[[@LINE-7]] | |
20 | } |