]> granicus.if.org Git - clang/commitdiff
Add a test for alloca region extents.
authorJordy Rose <jediknil@belkadan.com>
Sat, 14 Aug 2010 20:46:10 +0000 (20:46 +0000)
committerJordy Rose <jediknil@belkadan.com>
Sat, 14 Aug 2010 20:46:10 +0000 (20:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111079 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/outofbound.c

index 9b487300c88ad74efe7bdf239a81d8f245e1e87b..529f0e77b26f2df79545409cbc47e7aac22a585b 100644 (file)
@@ -71,3 +71,11 @@ void sizeof_vla(int a) {
     y[5] = 5; // expected-warning{{out-of-bound}}
   }
 }
+
+void alloca_region(int a) {
+  if (a == 5) {
+    char *x = __builtin_alloca(a);
+    x[4] = 4; // no-warning
+    x[5] = 5; // expected-warning{{out-of-bound}}
+  }
+}