diff options
author | Marek Polacek <polacek@redhat.com> | 2016-05-24 16:22:31 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-05-24 16:22:31 +0000 |
commit | ef2ec9d9a2c2d7380d2cf992db20cf8599fc0e3d (patch) | |
tree | 69010c074301aa33926d1fa5c77ab513c99595c4 /gcc/gimplify.c | |
parent | 7adb26f20259aadcd6e2df6ece474eca615af978 (diff) | |
download | gcc-ef2ec9d9a2c2d7380d2cf992db20cf8599fc0e3d.zip gcc-ef2ec9d9a2c2d7380d2cf992db20cf8599fc0e3d.tar.gz gcc-ef2ec9d9a2c2d7380d2cf992db20cf8599fc0e3d.tar.bz2 |
re PR middle-end/71249 (-Wswitch-unreachable false positive for a compound statement containing a used label)
PR c/71249
* gimplify.c (gimplify_switch_expr): Look into the innermost lexical
scope.
* c-c++-common/Wswitch-unreachable-2.c: New test.
From-SVN: r236649
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e702bc4..67394e3 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1605,8 +1605,9 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p) && switch_body_seq != NULL) { gimple_seq seq = switch_body_seq; - if (gimple_code (switch_body_seq) == GIMPLE_BIND) - seq = gimple_bind_body (as_a <gbind *> (switch_body_seq)); + /* Look into the innermost lexical scope. */ + while (gimple_code (seq) == GIMPLE_BIND) + seq = gimple_bind_body (as_a <gbind *> (seq)); gimple *stmt = gimple_seq_first_stmt (seq); enum gimple_code code = gimple_code (stmt); if (code != GIMPLE_LABEL && code != GIMPLE_TRY) |