aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2006-03-13 14:18:24 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2006-03-13 14:18:24 +0000
commit3feaea007d5df4fab5820e2e01fb175894ff2d75 (patch)
tree21ce14481e92801758759cd21d6431455737ee3b /gcc/gimplify.c
parentba9462095c0f862c4eadf51a17356793cff6b767 (diff)
downloadgcc-3feaea007d5df4fab5820e2e01fb175894ff2d75.zip
gcc-3feaea007d5df4fab5820e2e01fb175894ff2d75.tar.gz
gcc-3feaea007d5df4fab5820e2e01fb175894ff2d75.tar.bz2
re PR middle-end/18859 (ACATS ICE c37305a at -O0: in tree_low_cst, at tree.c:3839)
PR middle-end/18859 * gimplify.c (gimplify_switch_expr): Discard empty ranges. * stmt.c (expand_case): Likewise. From-SVN: r112000
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index c9498ee..506ad18 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1327,20 +1327,34 @@ gimplify_switch_expr (tree *expr_p, tree *pre_p)
labels = gimplify_ctxp->case_labels;
gimplify_ctxp->case_labels = saved_labels;
- len = VEC_length (tree, labels);
-
- for (i = 0; i < len; ++i)
+ i = 0;
+ while (i < VEC_length (tree, labels))
{
- tree t = VEC_index (tree, labels, i);
- if (!CASE_LOW (t))
+ tree elt = VEC_index (tree, labels, i);
+ tree low = CASE_LOW (elt);
+ bool remove_element = FALSE;
+
+ if (low)
+ {
+ /* Discard empty ranges. */
+ tree high = CASE_HIGH (elt);
+ if (high && INT_CST_LT (high, low))
+ remove_element = TRUE;
+ }
+ else
{
/* The default case must be the last label in the list. */
- default_case = t;
- VEC_replace (tree, labels, i, VEC_index (tree, labels, len - 1));
- len--;
- break;
+ gcc_assert (!default_case);
+ default_case = elt;
+ remove_element = TRUE;
}
+
+ if (remove_element)
+ VEC_ordered_remove (tree, labels, i);
+ else
+ i++;
}
+ len = i;
label_vec = make_tree_vec (len + 1);
SWITCH_LABELS (*expr_p) = label_vec;