diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-05-09 05:35:08 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-05-09 05:35:08 +0000 |
commit | 7ebb4933750f008dfdaecc8b927024b794aa4b9b (patch) | |
tree | 3bc9692c6feb9e9f0b6e29e4d242c59aad17cdf5 /clang/test/Sema/array-bounds-ptr-arith.c | |
parent | 6f8d2c6c9c3451effdf075a7034bbe77045bfeba (diff) | |
download | bcm5719-llvm-7ebb4933750f008dfdaecc8b927024b794aa4b9b.tar.gz bcm5719-llvm-7ebb4933750f008dfdaecc8b927024b794aa4b9b.zip |
Teach IsTailPaddedMemberArray() (used by -Warray-bounds) that a FieldDecl may have a Typedef type, and not always a ConstantArrayType.
Fixes <rdar://problem/11387038>.
llvm-svn: 156464
Diffstat (limited to 'clang/test/Sema/array-bounds-ptr-arith.c')
-rw-r--r-- | clang/test/Sema/array-bounds-ptr-arith.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Sema/array-bounds-ptr-arith.c b/clang/test/Sema/array-bounds-ptr-arith.c index 022335bd37a..e3de06a104e 100644 --- a/clang/test/Sema/array-bounds-ptr-arith.c +++ b/clang/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]; +} |