summaryrefslogtreecommitdiffstats
path: root/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r--test/Sema/uninit-variables.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index b70a295..0caab3d 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -352,3 +352,18 @@ int test52(int a, int b) {
}
return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
}
+
+// This CFG caused the uninitialized values warning to inf-loop.
+extern int PR10379_g();
+void PR10379_f(int *len) {
+ int new_len; // expected-note {{variable 'new_len' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (int i = 0; i < 42 && PR10379_g() == 0; i++) {
+ if (PR10379_g() == 1)
+ continue;
+ if (PR10379_g() == 2)
+ PR10379_f(&new_len);
+ else if (PR10379_g() == 3)
+ PR10379_f(&new_len);
+ *len += new_len; // expected-warning {{variable 'new_len' may be uninitialized when used here}}
+ }
+}
OpenPOWER on IntegriCloud