When a constant size array is casted to another type, its length should be scaled as well.
llvm-svn: 106911
diff --git a/clang/test/Analysis/no-outofbounds.c b/clang/test/Analysis/no-outofbounds.c
index 771323b..49ee80e 100644
--- a/clang/test/Analysis/no-outofbounds.c
+++ b/clang/test/Analysis/no-outofbounds.c
@@ -12,3 +12,9 @@
short *z = (short*) &x;
short s = z[0] + z[1]; // no-warning
}
+
+void g() {
+ int a[2];
+ char *b = (char*)a;
+ b[3] = 'c'; // no-warning
+}
diff --git a/clang/test/Analysis/outofbound.c b/clang/test/Analysis/outofbound.c
index 2d09d8d..24766be 100644
--- a/clang/test/Analysis/outofbound.c
+++ b/clang/test/Analysis/outofbound.c
@@ -43,3 +43,9 @@
p[3] = '.'; // no-warning
p[4] = '!'; // expected-warning{{out-of-bound}}
}
+
+void f6() {
+ char a[2];
+ int *b = (int*)a;
+ b[1] = 3; // expected-warning{{out-of-bound}}
+}