From: Andrew Pinski Date: Tue, 19 Oct 2004 20:52:22 +0000 (+0000) Subject: tree-cfg.c (group_case_labels): Look at the second to last case statement for combing... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d717e500584bb2a81f0b5328f682c1b6d07ba8a6;p=gcc.git tree-cfg.c (group_case_labels): Look at the second to last case statement for combing with the default case. 2004-10-19 Andrew Pinski * tree-cfg.c (group_case_labels): Look at the second to last case statement for combing with the default case. From-SVN: r89288 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7616e12600..bafae457bef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-10-19 Andrew Pinski + + * tree-cfg.c (group_case_labels): Look at the second to last + case statement for combing with the default case. + 2004-10-19 Richard Hendeson PR 17962 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 0722df15ac3..1031f914265 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -948,7 +948,7 @@ group_case_labels (void) Ignore the last element of the label vector because it must be the default case. */ i = 0; - while (i < old_size - 2) + while (i < old_size - 1) { tree base_case, base_label, base_high, type; base_case = TREE_VEC_ELT (labels, i); @@ -969,13 +969,13 @@ group_case_labels (void) type = TREE_TYPE (CASE_LOW (base_case)); base_high = CASE_HIGH (base_case) ? CASE_HIGH (base_case) : CASE_LOW (base_case); - + i++; /* Try to merge case labels. Break out when we reach the end of the label vector or when we cannot merge the next case label with the current one. */ - while (i < old_size - 2) + while (i < old_size - 1) { - tree merge_case = TREE_VEC_ELT (labels, ++i); + tree merge_case = TREE_VEC_ELT (labels, i); tree merge_label = CASE_LABEL (merge_case); tree t = int_const_binop (PLUS_EXPR, base_high, integer_one_node, 1); @@ -990,6 +990,7 @@ group_case_labels (void) CASE_HIGH (base_case) = base_high; TREE_VEC_ELT (labels, i) = NULL_TREE; new_size--; + i++; } else break;