aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/bounds-checking.c
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-05-22 17:19:45 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-05-22 17:19:45 +0000
commitdef18494b97f554ea0d95db75627c3e77b74307f (patch)
tree2207c6057d204b9b591770eae96465d8d7bbe8bd /test/CodeGen/bounds-checking.c
parentbfbfee51ec8f20f3f1b9f8329705d816b67438e7 (diff)
wire -fbounds-checking to the new LLVM bounds checking pass
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/bounds-checking.c')
-rw-r--r--test/CodeGen/bounds-checking.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/CodeGen/bounds-checking.c b/test/CodeGen/bounds-checking.c
index 3271b76dcb..e2786203e6 100644
--- a/test/CodeGen/bounds-checking.c
+++ b/test/CodeGen/bounds-checking.c
@@ -3,23 +3,24 @@
// CHECK: @f
double f(int b, int i) {
double a[b];
+ // CHECK: trap
return a[i];
- // CHECK: objectsize.i64({{.*}}, i1 false)
- // CHECK: icmp uge i64 {{.*}}, 8
}
// CHECK: @f2
void f2() {
+ // everything is constant; no trap possible
+ // CHECK-NOT: trap
int a[2];
- // CHECK: objectsize.i64({{.*}}, i1 false)
- // CHECK: icmp uge i64 {{.*}}, 4
a[1] = 42;
short *b = malloc(64);
- // CHECK: objectsize.i64({{.*}}, i1 false)
- // CHECK: icmp uge i64 {{.*}}, 4
- // CHECK: getelementptr {{.*}}, i64 5
- // CHECK: objectsize.i64({{.*}}, i1 false)
- // CHECK: icmp uge i64 {{.*}}, 2
- b[5] = a[1]+2;
+ b[5] = *a + a[1] + 2;
+}
+
+// CHECK: @f3
+void f3() {
+ int a[1];
+ // CHECK: trap
+ a[2] = 1;
}