diff options
Diffstat (limited to 'test/CodeGen/bounds-checking.c')
-rw-r--r-- | test/CodeGen/bounds-checking.c | 21 |
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; } |