aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-01 17:43:18 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-01 17:43:18 +0000
commit9fcbceed43e5610fdff43defe533934733453ae2 (patch)
tree7cb229b6eb6fcbe4932142a3aaeca0335c9d0c1d /test/Sema/uninit-variables.c
parentd880f52be3e4a8ccad92ac31932eeae5e0870a93 (diff)
Enhance -Wuninitialized to better reason about || and &&, tracking dual dataflow facts and properly merging them.
Fixes PR 9076. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124666 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r--test/Sema/uninit-variables.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index f52c1b5fc2..f869ef2870 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -240,3 +240,23 @@ void test36()
goto *pc;
}
+// Test && nested in ||.
+int test37_a();
+int test37_b();
+int test37()
+{
+ int identifier;
+ if ((test37_a() && (identifier = 1)) ||
+ (test37_b() && (identifier = 2))) {
+ return identifier; // no-warning
+ }
+ return 0;
+}
+
+// Test merging of path-specific dataflow values (without asserting).
+int test38(int r, int x, int y)
+{
+ int z;
+ return ((r < 0) || ((r == 0) && (x < y)));
+}
+