diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-13 14:18:24 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-13 14:18:24 +0000 |
commit | b655fbd3ef94004574ead1e186e4ce832c543cae (patch) | |
tree | 21ce14481e92801758759cd21d6431455737ee3b /gcc/stmt.c | |
parent | 1e41d0e2b4276e36c7faf2b28c00c6607c894f45 (diff) | |
download | gcc-b655fbd3ef94004574ead1e186e4ce832c543cae.tar.gz |
PR middle-end/18859
* gimplify.c (gimplify_switch_expr): Discard empty ranges.
* stmt.c (expand_case): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112000 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c index 38a7f909e1b..d199398e55f 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2286,7 +2286,7 @@ emit_case_bit_tests (tree index_type, tree index_expr, tree minval, #define HAVE_tablejump 0 #endif -/* Terminate a case (Pascal) or switch (C) statement +/* Terminate a case (Pascal/Ada) or switch (C) statement in which ORIG_INDEX is the expression to be tested. If ORIG_TYPE is not NULL, it is the original ORIG_INDEX type as given in the source before any compiler conversions. @@ -2348,10 +2348,18 @@ expand_case (tree exp) for (i = TREE_VEC_LENGTH (vec) - 1; --i >= 0; ) { + tree low, high; elt = TREE_VEC_ELT (vec, i); - gcc_assert (CASE_LOW (elt)); - case_list = add_case_node (case_list, index_type, - CASE_LOW (elt), CASE_HIGH (elt), + + low = CASE_LOW (elt); + gcc_assert (low); + high = CASE_HIGH (elt); + + /* Discard empty ranges. */ + if (high && INT_CST_LT (high, low)) + continue; + + case_list = add_case_node (case_list, index_type, low, high, CASE_LABEL (elt)); } |