summaryrefslogtreecommitdiffstats
path: root/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-06-12 15:46:16 +0000
committerdim <dim@FreeBSD.org>2011-06-12 15:46:16 +0000
commitc49018d9cce52d8c9f34b44865ec3ba8e89a1488 (patch)
treec5e9e10bc189de0058aa763c47b9920a8351b7df /test/Sema/uninit-variables.c
parent110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab (diff)
downloadFreeBSD-src-c49018d9cce52d8c9f34b44865ec3ba8e89a1488.zip
FreeBSD-src-c49018d9cce52d8c9f34b44865ec3ba8e89a1488.tar.gz
Vendor import of clang trunk r132879:
http://llvm.org/svn/llvm-project/cfe/trunk@132879
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r--test/Sema/uninit-variables.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index 60cae80..b70a295 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -339,3 +339,16 @@ int test51(void)
return a; // no-warning
}
+// FIXME: This is a false positive, but it tests logical operations in switch statements.
+int test52(int a, int b) {
+ int x; // expected-note {{variable 'x' is declared here}} expected-note {{add initialization to silence this warning}}
+ switch (a || b) { // expected-warning {{switch condition has boolean value}}
+ case 0:
+ x = 1;
+ break;
+ case 1:
+ x = 2;
+ break;
+ }
+ return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
+}
OpenPOWER on IntegriCloud