summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc-sizeof.c
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-09-08 00:09:02 +0000
committerAnna Zaks <ganna@apple.com>2012-09-08 00:09:02 +0000
commit044f3e2694079cce9a5b1373ee145bcb5b2a35e7 (patch)
tree0035803003abe05cc764d252c212498ebec57e95 /clang/test/Analysis/malloc-sizeof.c
parentd3b4d2cb761ced83a9a4598c12ad9268efe75e29 (diff)
downloadbcm5719-llvm-044f3e2694079cce9a5b1373ee145bcb5b2a35e7.tar.gz
bcm5719-llvm-044f3e2694079cce9a5b1373ee145bcb5b2a35e7.zip
[analyzer] Address John's code review for r163407.
Teach malloc sizeof checker to find type inconsistencies in multi- dimensional arrays. llvm-svn: 163438
Diffstat (limited to 'clang/test/Analysis/malloc-sizeof.c')
-rw-r--r--clang/test/Analysis/malloc-sizeof.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/test/Analysis/malloc-sizeof.c b/clang/test/Analysis/malloc-sizeof.c
index 943c4ce17c8..7a8585fa844 100644
--- a/clang/test/Analysis/malloc-sizeof.c
+++ b/clang/test/Analysis/malloc-sizeof.c
@@ -37,9 +37,11 @@ void ignore_const() {
int *mallocArraySize() {
static const int sTable[10];
- static const int nestedTable[10][10];
+ static const int nestedTable[10][2];
int *table = malloc(sizeof sTable);
int *table1 = malloc(sizeof nestedTable);
+ int (*table2)[2] = malloc(sizeof nestedTable);
+ int (*table3)[10][2] = malloc(sizeof nestedTable);
return table;
}
OpenPOWER on IntegriCloud