summaryrefslogtreecommitdiffstats
path: root/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-04-14 14:01:31 +0000
committerdim <dim@FreeBSD.org>2012-04-14 14:01:31 +0000
commit50b73317314e889cf39c7b1d6cbf419fa7502f22 (patch)
treebe1815eb79b42ff482a8562b13c2dcbf0c5dcbee /test/Sema/uninit-variables.c
parentdc04cb328508e61aad809d9b53b12f9799a00e7d (diff)
downloadFreeBSD-src-50b73317314e889cf39c7b1d6cbf419fa7502f22.zip
FreeBSD-src-50b73317314e889cf39c7b1d6cbf419fa7502f22.tar.gz
Vendor import of clang trunk r154661:
http://llvm.org/svn/llvm-project/cfe/trunk@r154661
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