diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-12-03 18:29:20 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-12-03 18:29:20 +0000 |
commit | 9f303beca8a71368e34f53dd14eed7a3b51331ca (patch) | |
tree | f07b87ad8d0d1b089b98729972c361517c3f0385 | |
parent | 51f940457ab20f82c62c2093389763bb9f5187eb (diff) |
Add another blocks test case illustrating how parameters passed-by-reference in block invocations are invalidated (just like function calls).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90466 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/misc-ps-region-store.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 9d6825a75e..ee2043c214 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -568,3 +568,18 @@ int blocks_1(int *p, int z) { return z; } +int blocks_2(int *p, int z) { + int *q = 0; + void (^bar)(int **) = ^(int **r){ *r = p; }; + + if (z) { + // The call to 'bar' might cause 'q' to be invalidated. + bar(&q); + *q = 0x1; // no-warning + } + else { + *q = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}} + } + return z; +} + |