summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-10 01:11:12 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-10 01:11:12 +0000
commit481652b3e3f9e411b4f4ade2b1f230a364057962 (patch)
treedc8a4dfb0e9d34046154cd7bf564b791afa3c7cd /clang/test
parent22cc16462e4190717a5a67b38d3ffaa0983c2c26 (diff)
downloadbcm5719-llvm-481652b3e3f9e411b4f4ade2b1f230a364057962.tar.gz
bcm5719-llvm-481652b3e3f9e411b4f4ade2b1f230a364057962.zip
-fcatch-undefined-behavior: catch a VLA bound which evalutes to a non-positive value.
llvm-svn: 165583
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/catch-undef-behavior.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/CodeGen/catch-undef-behavior.c b/clang/test/CodeGen/catch-undef-behavior.c
index 2fe61ea6758..e8b5cbcd56f 100644
--- a/clang/test/CodeGen/catch-undef-behavior.c
+++ b/clang/test/CodeGen/catch-undef-behavior.c
@@ -15,6 +15,7 @@
// CHECK: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i64 4, i8 3 }
// CHECK: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
+// CHECK: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
// PR6805
// CHECK: @foo
@@ -130,3 +131,13 @@ int no_return() {
// CHECK-NOT: unreachable
// CHECK: ret i32
}
+
+// CHECK: @vla_bound
+void vla_bound(int n) {
+ // CHECK: icmp sgt i32 %[[PARAM:.*]], 0
+ //
+ // CHECK: %[[ARG:.*]] = zext i32 %[[PARAM]] to i64
+ // CHECK-NEXT: call void @__ubsan_handle_vla_bound_not_positive(i8* bitcast ({{.*}} @[[LINE_900]] to i8*), i64 %[[ARG]]) noreturn nounwind
+#line 900
+ int arr[n * 3];
+}
OpenPOWER on IntegriCloud