Teach UninitializedValuesV2 about "int x = x" and
also properly handle confluence of loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123733 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index c2d98c4..51e6675 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -85,4 +85,20 @@
return i; // no-warning
}
+// Simply don't crash on this test case.
+void test14() {
+ const char *p = 0;
+ for (;;) {}
+}
+void test15() {
+ int x = x; // expected-warning{{use of uninitialized variable 'x'}}
+}
+
+// Don't warn in the following example; shows dataflow confluence.
+char *test16_aux();
+void test16() {
+ char *p = test16_aux();
+ for (unsigned i = 0 ; i < 100 ; i++)
+ p[i] = 'a'; // no-warning
+}