From: Ted Kremenek Date: Mon, 20 Oct 2008 23:14:31 +0000 (+0000) Subject: Added test case inspired by : recover path-sensitivity after compound... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9253b0f3d70b49f216e86447494ec0ff2315b31a;p=clang Added test case inspired by : recover path-sensitivity after compound assignment when the result of the assignment is not known. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57852 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index ab00bd8c34..956d0dfb59 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -13,3 +13,19 @@ // http://llvm.org/bugs/show_bug.cgi?id=2796 unsigned foo(unsigned x) { return __alignof__((x)) + sizeof(x); } + +// Improvement to path-sensitivity involving compound assignments. +// Addresses false positive in +// + +unsigned r6268365Aux(); + +void r6268365() { + unsigned x = 0; + x &= r6268365Aux(); + unsigned j = 0; + + if (x == 0) ++j; + if (x == 0) x = x / j; // no-warning +} +