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.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index 49af4f3..d62186d 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -44,6 +44,15 @@ int test7(int y) {
return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
}
+int test7b(int y) {
+ int x = x; // expected-note{{variable 'x' is declared here}}
+ if (y)
+ x = 1;
+ // Warn with "may be uninitialized" here (not "is uninitialized"), since the
+ // self-initialization is intended to suppress a -Wuninitialized warning.
+ return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
+}
+
int test8(int y) {
int x;
if (y)
@@ -415,4 +424,3 @@ void rdar9432305(float *P) {
for (; i < 10000; ++i) // expected-warning {{variable 'i' is uninitialized when used here}}
P[i] = 0.0f;
}
-
OpenPOWER on IntegriCloud