]> granicus.if.org Git - clang/commitdiff
Add test case for PR 4358.
authorTed Kremenek <kremenek@apple.com>
Thu, 24 Dec 2009 00:48:11 +0000 (00:48 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 24 Dec 2009 00:48:11 +0000 (00:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92103 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/misc-ps-region-store.m

index 7216608fe9f5aaad159399337beca952cad93960..7f29c99a44d766ac0105684e55bbb936f49a2f2f 100644 (file)
@@ -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
+}