2012-08-15 16:29:17 +08:00
|
|
|
// Sanity checking a test in pure C.
|
2013-06-07 17:38:55 +08:00
|
|
|
// RUN: %clang_asan -O2 %s -o %t
|
2014-05-01 05:34:17 +08:00
|
|
|
// RUN: not %run %t 2>&1 | FileCheck %s
|
2012-08-15 16:29:17 +08:00
|
|
|
|
|
|
|
// Sanity checking a test in pure C with -pie.
|
2014-04-01 21:16:30 +08:00
|
|
|
// RUN: %clang_asan -O2 %s -pie -fPIE -o %t
|
2014-05-01 05:34:17 +08:00
|
|
|
// RUN: not %run %t 2>&1 | FileCheck %s
|
2014-06-07 02:06:58 +08:00
|
|
|
// XFAIL: arm-linux-gnueabi
|
2014-10-09 05:13:23 +08:00
|
|
|
// XFAIL: armv7l-unknown-linux-gnueabihf
|
2012-08-15 16:29:17 +08:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main() {
|
|
|
|
char *x = (char*)malloc(10 * sizeof(char));
|
|
|
|
free(x);
|
|
|
|
return x[5];
|
|
|
|
// CHECK: heap-use-after-free
|
2012-08-15 22:33:30 +08:00
|
|
|
// CHECK: free
|
2012-12-28 16:38:09 +08:00
|
|
|
// CHECK: main{{.*}}sanity_check_pure_c.c:[[@LINE-4]]
|
2012-08-15 22:33:30 +08:00
|
|
|
// CHECK: malloc
|
2012-12-28 16:38:09 +08:00
|
|
|
// CHECK: main{{.*}}sanity_check_pure_c.c:[[@LINE-7]]
|
2012-08-15 16:29:17 +08:00
|
|
|
}
|