summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/uninit-variables.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-09-02 19:39:26 +0000
committerTed Kremenek <kremenek@apple.com>2011-09-02 19:39:26 +0000
commitaed4677a1ceab01b3cee11300795febebd54d25f (patch)
treec8335a01f3fd1ab569e6d5f3f787daa0fe054b24 /clang/test/Sema/uninit-variables.c
parent05dec8b12249fb1d3e25ce8d120f1aae178157ac (diff)
downloadbcm5719-llvm-aed4677a1ceab01b3cee11300795febebd54d25f.tar.gz
bcm5719-llvm-aed4677a1ceab01b3cee11300795febebd54d25f.zip
-Wuninitialized: fix insidious bug resulting from interplay of blocks and dead code. Fixes <rdar://problem/10060250>.
llvm-svn: 139027
Diffstat (limited to 'clang/test/Sema/uninit-variables.c')
-rw-r--r--clang/test/Sema/uninit-variables.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Sema/uninit-variables.c b/clang/test/Sema/uninit-variables.c
index f26e478bdfc..dbde333d751 100644
--- a/clang/test/Sema/uninit-variables.c
+++ b/clang/test/Sema/uninit-variables.c
@@ -381,3 +381,13 @@ void test_vla_sizeof(int x) {
double (*memory)[2][x] = malloc(sizeof(*memory)); // no-warning
}
+// Test absurd case of deadcode + use of blocks. This previously was a false positive
+// due to an analysis bug.
+int test_block_and_dead_code() {
+ __block int x;
+ ^{ x = 1; }();
+ if (0)
+ return x;
+ return x; // no-warning
+}
+
OpenPOWER on IntegriCloud