aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/array-bounds-ptr-arith.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-05-09 05:35:08 +0000
committerTed Kremenek <kremenek@apple.com>2012-05-09 05:35:08 +0000
commit00e1f6f5fed4f33f67181578be0232accd342282 (patch)
tree95cebec5ab347f9838b1d10cf3f60f2250102048 /test/Sema/array-bounds-ptr-arith.c
parent4493c0aa8add05b2fc534b0d8970c4b5480fad3b (diff)
Teach IsTailPaddedMemberArray() (used by -Warray-bounds) that a FieldDecl may have a Typedef type, and not always a ConstantArrayType.
Fixes <rdar://problem/11387038>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/array-bounds-ptr-arith.c')
-rw-r--r--test/Sema/array-bounds-ptr-arith.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Sema/array-bounds-ptr-arith.c b/test/Sema/array-bounds-ptr-arith.c
index 022335bd37..e3de06a104 100644
--- a/test/Sema/array-bounds-ptr-arith.c
+++ b/test/Sema/array-bounds-ptr-arith.c
@@ -19,3 +19,21 @@ void pr11594(struct S *s) {
int a[10];
int *p = a - s->n;
}
+
+// Test case reduced from <rdar://problem/11387038>. This resulted in
+// an assertion failure because of the typedef instead of an explicit
+// constant array type.
+struct RDar11387038 {};
+typedef struct RDar11387038 RDar11387038Array[1];
+struct RDar11387038_Table {
+ RDar11387038Array z;
+};
+typedef struct RDar11387038_Table * TPtr;
+typedef TPtr *TabHandle;
+struct RDar11387038_B { TabHandle x; };
+typedef struct RDar11387038_B RDar11387038_B;
+
+void radar11387038() {
+ RDar11387038_B *pRDar11387038_B;
+ struct RDar11387038* y = &(*pRDar11387038_B->x)->z[4];
+}