diff options
Diffstat (limited to 'test/Analysis/misc-ps-region-store.m')
-rw-r--r-- | test/Analysis/misc-ps-region-store.m | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 21a54c3..898a33e 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -888,3 +888,25 @@ char *rdar_7242010(int count, char **y) { return y[0]; // no-warning } +//===----------------------------------------------------------------------===// +// <rdar://problem/7770737> +//===----------------------------------------------------------------------===// + +struct rdar_7770737_s { intptr_t p; }; +void rdar_7770737_aux(struct rdar_7770737_s *p); +int rdar_7770737(void) +{ + int x; + + // Previously 'f' was not properly invalidated, causing the use of + // an uninitailized value below. + struct rdar_7770737_s f = { .p = (intptr_t)&x }; + rdar_7770737_aux(&f); + return x; // no-warning +} +int rdar_7770737_pos(void) +{ + int x; + struct rdar_7770737_s f = { .p = (intptr_t)&x }; + return x; // expected-warning{{Undefined or garbage value returned to caller}} +} |