summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorPeter Bergner <bergner@vnet.ibm.com>2017-06-29 07:58:32 -0500
committerPeter Bergner <bergner@gcc.gnu.org>2017-06-29 07:58:32 -0500
commitf66459c1605ab66390ad5b5c54e425f96607d9eb (patch)
treefc3f329844a8125ad6b273d8b28aeb02e1aa8f15 /gcc/cfgexpand.c
parent3c7bb4891238d341dcd1404cf45b041fc1af0720 (diff)
downloadgcc-f66459c1605ab66390ad5b5c54e425f96607d9eb.tar.gz
re PR middle-end/81194 (ICE during RTL pass: expand)
gcc/ PR middle-end/81194 * cfgexpand.c (expand_gimple_stmt_1): Handle switch statements with only one label. * stmt.c (expand_case): Assert NCASES is greater than one. gcc/testsuite/ PR middle-end/81194 * g++.dg/pr81194.C: New test. From-SVN: r249783
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index c1f80727d30..d61c261a172 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3566,7 +3566,13 @@ expand_gimple_stmt_1 (gimple *stmt)
case GIMPLE_PREDICT:
break;
case GIMPLE_SWITCH:
- expand_case (as_a <gswitch *> (stmt));
+ {
+ gswitch *swtch = as_a <gswitch *> (stmt);
+ if (gimple_switch_num_labels (swtch) == 1)
+ expand_goto (CASE_LABEL (gimple_switch_default_label (swtch)));
+ else
+ expand_case (swtch);
+ }
break;
case GIMPLE_ASM:
expand_asm_stmt (as_a <gasm *> (stmt));