2007-08-01 Diego Novillo * gimplify.c (gimplify_switch_expr): Do not call sort_case_labels if there are no labels other than 'default'. * gimple.h (gimple_num_ops, gimple_op, gimple_set_op): Use result of GIMPLE_RANGE_CHECK call. Index: gimplify.c =================================================================== --- gimplify.c (revision 127104) +++ gimplify.c (working copy) @@ -1455,7 +1455,9 @@ gimplify_switch_expr (tree *expr_p, gimp default_case = gimple_label_label (new_default); } - sort_case_labels (labels); + if (!VEC_empty (tree, labels)) + sort_case_labels (labels); + gimple_switch = build_gimple_switch_vec (SWITCH_COND (switch_expr), default_case, labels); gimple_add (pre_p, gimple_switch); Index: gimple.h =================================================================== --- gimple.h (revision 127104) +++ gimple.h (working copy) @@ -472,24 +472,24 @@ extern void gimple_range_check_failed (c static inline size_t gimple_num_ops (gimple gs) { - GIMPLE_RANGE_CHECK (gs, GIMPLE_ASSIGN, GIMPLE_RETURN); - return gs->with_ops.num_ops; + gimple g = GIMPLE_RANGE_CHECK (gs, GIMPLE_ASSIGN, GIMPLE_RETURN); + return g->with_ops.num_ops; } static inline tree gimple_op (gimple gs, size_t i) { - GIMPLE_RANGE_CHECK (gs, GIMPLE_ASSIGN, GIMPLE_RETURN); - gcc_assert (i < gs->with_ops.num_ops); - return gs->with_ops.op[i]; + gimple g = GIMPLE_RANGE_CHECK (gs, GIMPLE_ASSIGN, GIMPLE_RETURN); + gcc_assert (i < g->with_ops.num_ops); + return g->with_ops.op[i]; } static inline void gimple_set_op (gimple gs, size_t i, tree op) { - GIMPLE_RANGE_CHECK (gs, GIMPLE_ASSIGN, GIMPLE_RETURN); - gcc_assert (i < gs->with_ops.num_ops); - gs->with_ops.op[i] = op; + gimple g = GIMPLE_RANGE_CHECK (gs, GIMPLE_ASSIGN, GIMPLE_RETURN); + gcc_assert (i < g->with_ops.num_ops); + g->with_ops.op[i] = op; }