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
diff --git a/test/CodeGen/bounds-checking.c b/test/CodeGen/bounds-checking.c
index 3271b76..e278620 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;
}