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 | 2a3dbb57496d1d970664ce9ca6ddce71c126ecd5 (patch) | |
tree | b0ae2a638a4533b69bb5d6c14f9496cf8ce239d6 | |
parent | ae3c5cf76a4d4dd172d4cc9dabd96dadd826fda5 (diff) | |
download | bcm5719-llvm-2a3dbb57496d1d970664ce9ca6ddce71c126ecd5.tar.gz bcm5719-llvm-2a3dbb57496d1d970664ce9ca6ddce71c126ecd5.zip |
Add another blocks test case illustrating how parameters passed-by-reference in block invocations are invalidated (just like function calls).
llvm-svn: 90466
-rw-r--r-- | clang/test/Analysis/misc-ps-region-store.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m index 9d6825a75e2..ee2043c214d 100644 --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/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; +} + |