diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-22 17:19:45 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-22 17:19:45 +0000 |
commit | a425589feac540f1792d2e698c1cb0103ba1ec86 (patch) | |
tree | 7b9d117ca5c26ff1d8376f6f1c20f51931a748d7 /clang/test/CodeGen | |
parent | a2f6cecb6d18bcc59d6c702378ed0701cd0208ae (diff) | |
download | bcm5719-llvm-a425589feac540f1792d2e698c1cb0103ba1ec86.tar.gz bcm5719-llvm-a425589feac540f1792d2e698c1cb0103ba1ec86.zip |
wire -fbounds-checking to the new LLVM bounds checking pass
llvm-svn: 157262
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r-- | clang/test/CodeGen/bounds-checking.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/test/CodeGen/bounds-checking.c b/clang/test/CodeGen/bounds-checking.c index 3271b76dcbd..e2786203e6a 100644 --- a/clang/test/CodeGen/bounds-checking.c +++ b/clang/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; } |