aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/outofbound.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/outofbound.c')
-rw-r--r--test/Analysis/outofbound.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c
index e1ff66ccf4..2d09d8d76c 100644
--- a/test/Analysis/outofbound.c
+++ b/test/Analysis/outofbound.c
@@ -2,6 +2,7 @@
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
+void *calloc(size_t, size_t);
char f1() {
char* s = "abcd";
@@ -36,3 +37,9 @@ void f4() {
p[1] = a; // no-warning
p[2] = a; // expected-warning{{Access out-of-bound array element (buffer overflow)}}
}
+
+void f5() {
+ char *p = calloc(2,2);
+ p[3] = '.'; // no-warning
+ p[4] = '!'; // expected-warning{{out-of-bound}}
+}