summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/bounds-checking.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerdim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commit952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /test/CodeGen/bounds-checking.c
parentea266cad53e3d49771fa38103913d3ec7a166694 (diff)
downloadFreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip
FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/CodeGen/bounds-checking.c')
-rw-r--r--test/CodeGen/bounds-checking.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/CodeGen/bounds-checking.c b/test/CodeGen/bounds-checking.c
index fa7541f..d93cd3e 100644
--- a/test/CodeGen/bounds-checking.c
+++ b/test/CodeGen/bounds-checking.c
@@ -1,26 +1,29 @@
-// RUN: %clang_cc1 -fsanitize=bounds -emit-llvm -triple x86_64-apple-darwin10 < %s | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=local-bounds -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=array-bounds -O -fsanitize-undefined-trap-on-error -emit-llvm -triple x86_64-apple-darwin10 -DNO_DYNAMIC %s -o - | FileCheck %s
-// CHECK: @f
+// CHECK-LABEL: @f
double f(int b, int i) {
double a[b];
- // CHECK: trap
+ // CHECK: call {{.*}} @llvm.trap
return a[i];
}
-// CHECK: @f2
+// CHECK-LABEL: @f2
void f2() {
// everything is constant; no trap possible
- // CHECK-NOT: trap
+ // CHECK-NOT: call {{.*}} @llvm.trap
int a[2];
a[1] = 42;
-
+
+#ifndef NO_DYNAMIC
short *b = malloc(64);
b[5] = *a + a[1] + 2;
+#endif
}
-// CHECK: @f3
+// CHECK-LABEL: @f3
void f3() {
int a[1];
- // CHECK: trap
+ // CHECK: call {{.*}} @llvm.trap
a[2] = 1;
}
OpenPOWER on IntegriCloud