diff options
| author | Ted Kremenek <kremenek@apple.com> | 2012-11-29 00:50:20 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2012-11-29 00:50:20 +0000 |
| commit | 2317f30f4d7250a718d2b7e50bb201b4e59ad255 (patch) | |
| tree | d64816addf3a73cc2377a54d1830e38a6d0c9fc0 /clang/test/Analysis | |
| parent | 9ae53f8e3a46de8fc32d102569ab0a191d435077 (diff) | |
| download | bcm5719-llvm-2317f30f4d7250a718d2b7e50bb201b4e59ad255.tar.gz bcm5719-llvm-2317f30f4d7250a718d2b7e50bb201b4e59ad255.zip | |
Correctly handle IntegralToBool casts in C++ in the static analyzer. Fixes <rdar://problem/12759044>.
llvm-svn: 168843
Diffstat (limited to 'clang/test/Analysis')
| -rw-r--r-- | clang/test/Analysis/misc-ps-region-store.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps-region-store.cpp b/clang/test/Analysis/misc-ps-region-store.cpp index 12521401103..7b7b8bd3009 100644 --- a/clang/test/Analysis/misc-ps-region-store.cpp +++ b/clang/test/Analysis/misc-ps-region-store.cpp @@ -694,3 +694,14 @@ const Rdar12755044_foo *radar12755044() { static const Rdar12755044_foo Rdar12755044_foo_list[] = { { { } } }; return Rdar12755044_foo_list; // no-warning } + +// Test the correct handling of integer to bool conversions. Previously +// this resulted in a false positive because integers were being truncated +// and not tested for non-zero. +void rdar12759044() { + int flag = 512; + if (!(flag & 512)) { + int *p = 0; + *p = 0xDEADBEEF; // no-warning + } +} |

