aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/array-struct-region.c
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2012-05-12 17:32:59 +0000
committerJordy Rose <jediknil@belkadan.com>2012-05-12 17:32:59 +0000
commitf1139400e8015b3fc4bbb125df79d9fa1ca18bf6 (patch)
treeee7bf9b1d60f5773c7328e3e3a82dbde21fa6b90 /test/Analysis/array-struct-region.c
parent3eda6fa901b462f0b5f72d0651f46d804aac1844 (diff)
[analyzer] Test case: p->x is the same as p[0].x. (PR7297)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/array-struct-region.c')
-rw-r--r--test/Analysis/array-struct-region.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Analysis/array-struct-region.c b/test/Analysis/array-struct-region.c
index 4b085c8d70..8be86883a0 100644
--- a/test/Analysis/array-struct-region.c
+++ b/test/Analysis/array-struct-region.c
@@ -45,3 +45,16 @@ void nested_compound_literals_float(float rad) {
vec[a][1] *= rad; // no-warning
}
}
+
+
+void struct_as_array() {
+ struct simple { int x; };
+ struct simple a;
+ struct simple *p = &a;
+ p->x = 5;
+ if (!p[0].x)
+ return; // expected-warning{{never executed}}
+ if (p[0].x)
+ return; // no-warning
+}
+