diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-07 12:35:44 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-07 12:35:44 +0000 |
commit | 3a7ac8c646cda3e48f1400fe70b5f0f4fbe00cf6 (patch) | |
tree | 420e095cc8a34ead3cff2466554c1692c35856fe | |
parent | 7c4d4cbb54a12d1c3b733c3d0f32adbf4be092fc (diff) | |
download | gcc-3a7ac8c646cda3e48f1400fe70b5f0f4fbe00cf6.tar.gz |
gcc/
PR tree-optimization/53881
* tree-switch-conversion.c (emit_case_bit_tests): Do not rely on
comparing labels to establish uniqueness of a switch case target,
use the CFG instead.
testsuite/
PR tree-optimization/53881
* gcc.dg/pr53881.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189349 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr53881.c | 22 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.c | 5 |
4 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1e1f7dca83b..908a6792ece 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-07-07 Steven Bosscher <steven@gcc.gnu.org> + + PR tree-optimization/53881 + * tree-switch-conversion.c (emit_case_bit_tests): Do not rely on + comparing labels to establish uniqueness of a switch case target, + use the CFG instead. + 2012-07-07 Ulrich Weigand <ulrich.weigand@linaro.org> * combine.c (force_to_mode) [LSHIFTRT]: Avoid undefined behaviour diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e79dc33fb7..b7b0a5ce8f7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-07-07 Steven Bosscher <steven@gcc.gnu.org> + + PR tree-optimization/53881 + * gcc.dg/pr53881.c: New test. + 2012-07-06 Jason Merrill <jason@redhat.com> PR c++/53862 diff --git a/gcc/testsuite/gcc.dg/pr53881.c b/gcc/testsuite/gcc.dg/pr53881.c new file mode 100644 index 00000000000..435d938a400 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr53881.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int a, b; +void +fn1 () +{ + int c; + switch (a) + { + case 8: + c = 0; + goto Label; + case 0: + case 1: +Label: + break; + default: + b = 0; + } +} + diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index de8c9e874d6..94fbf1dec69 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -329,14 +329,13 @@ emit_case_bit_tests (gimple swtch, tree index_expr, unsigned int lo, hi; tree cs = gimple_switch_label (swtch, i); tree label = CASE_LABEL (cs); + edge e = find_edge (switch_bb, label_to_block (label)); for (k = 0; k < count; k++) - if (label == test[k].label) + if (e == test[k].target_edge) break; if (k == count) { - edge e = find_edge (switch_bb, label_to_block (label)); - gcc_assert (e); gcc_checking_assert (count < MAX_CASE_BIT_TESTS); test[k].hi = 0; test[k].lo = 0; |