aboutsummaryrefslogtreecommitdiff
path: root/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
commit6f27542da8843b5c1c579b86e342385bcc43d5f0 (patch)
tree3c63c5e796f010ebddacb0163791886efa4f88c7 /test/Sema/uninit-variables.c
parentda8e571ce443304665de1a1713980e7f2a2dbc54 (diff)
-Wuninitialized: fix insidious bug resulting from interplay of blocks and dead code. Fixes <rdar://problem/10060250>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r--test/Sema/uninit-variables.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index f26e478bdf..dbde333d75 100644
--- a/test/Sema/uninit-variables.c
+++ b/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
+}
+