diff options
Diffstat (limited to 'test/Analysis/array-struct.c')
-rw-r--r-- | test/Analysis/array-struct.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c index 438e1cc..da7df4b 100644 --- a/test/Analysis/array-struct.c +++ b/test/Analysis/array-struct.c @@ -2,8 +2,8 @@ // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s // RegionStore now has an infinite recursion with this test case. -// NOWORK: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// NOWORK: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s struct s { int data; @@ -157,3 +157,26 @@ struct s3 p[1]; void f16(struct s3 *p) { struct s3 a = *((struct s3*) ((char*) &p[0])); } + +void inv(struct s1 *); + +// Invalidate the struct field. +void f17() { + struct s1 t; + int x; + inv(&t); + if (t.e.d) + x = 1; +} + +void read(char*); + +void f18() { + char *q; + char *p = (char *) __builtin_alloca(10); + read(p); + q = p; + q++; + if (*q) { // no-warning + } +} |