From: Ted Kremenek Date: Thu, 24 Dec 2009 00:48:11 +0000 (+0000) Subject: Add test case for PR 4358. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cafefbe180bacd2c02c87ae1193f83fc6798cdfc;p=clang Add test case for PR 4358. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92103 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 7216608fe9..7f29c99a44 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -662,3 +662,25 @@ int pr5857(char *src) { return 1; } +//===----------------------------------------------------------------------===// +// PR 4358 - Without field-sensitivity, this code previously triggered +// a false positive that 'uninit' could be uninitialized at the call +// to pr4358_aux(). +//===----------------------------------------------------------------------===// + +struct pr4358 { + int bar; + int baz; +}; +void pr4358_aux(int x); +void pr4358(struct pr4358 *pnt) { + int uninit; + if (pnt->bar < 3) { + uninit = 1; + } else if (pnt->baz > 2) { + uninit = 3; + } else if (pnt->baz <= 2) { + uninit = 2; + } + pr4358_aux(uninit); // no-warning +}