From 284d76441878d22e55386cb5f0612710a0c2a9f3 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 24 Dec 2009 00:48:11 +0000 Subject: Add test case for PR 4358. llvm-svn: 92103 --- clang/test/Analysis/misc-ps-region-store.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'clang/test') diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m index 7216608fe9f..7f29c99a44d 100644 --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/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 +} -- cgit v1.2.3