Fixed bogus culling of uninitialized-values "taint" propagation during assignments.
We accidentally were throttling the propagation of uninitialized state across
assignments (e.g. x = y). Thanks to Anders Carlsson for spotting this problem.
Added test cases to test suite to provide regression testing for the
uninitialized values analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44306 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/uninit-vals.c b/test/Analysis/uninit-vals.c
new file mode 100644
index 0000000..641acd1
--- /dev/null
+++ b/test/Analysis/uninit-vals.c
@@ -0,0 +1,29 @@
+// RUN: clang -warn-uninit-values -verify %s
+
+int f1() {
+ int x;
+ return x; // expected-warning{use of uninitialized variable}
+}
+
+int f2(int x) {
+ int y;
+ int z = x + y; // expected-warning {use of uninitialized variable}
+ return z;
+}
+
+
+int f3(int x) {
+ int y;
+ return x ? 1 : y; // expected-warning {use of uninitialized variable}
+}
+
+int f4(int x) {
+ int y;
+ if (x) y = 1;
+ return y; // no-warning
+}
+
+int f5() {
+ int a;
+ a = 30; // no-warning
+}