aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2005-02-18 12:20:49 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2005-02-18 12:20:49 +0000
commit2aabee29e107c927902a9a62b2328f88db17d993 (patch)
treea9c7d9f0218df9d72684d8174c257d1e35351b39 /gcc/stmt.c
parentaeba6c285a2b7da7ee090cc51d3e96838b567398 (diff)
downloadgcc-2aabee29e107c927902a9a62b2328f88db17d993.zip
gcc-2aabee29e107c927902a9a62b2328f88db17d993.tar.gz
gcc-2aabee29e107c927902a9a62b2328f88db17d993.tar.bz2
re PR c++/20008 (internal compiler error: in expand_case, at stmt.c:2397)
gcc/ChangeLog: PR c++/20008 * stmt.c (expand_case): Don't assume cleanup_tree_cfg will remove cases that are out-of-range for the index type. gcc/testsuite/ChangeLog: PR c++/20008 * g++.dg/opt/switch4.C: New. From-SVN: r95225
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index a438532..64e070b 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -2394,8 +2394,14 @@ expand_case (tree exp)
BITMAP_FREE (label_bitmap);
/* cleanup_tree_cfg removes all SWITCH_EXPR with a single
- destination, such as one with a default case only. */
- gcc_assert (count != 0);
+ destination, such as one with a default case only. However,
+ it doesn't remove cases that are out of range for the switch
+ type, so we may still get a zero here. */
+ if (count == 0)
+ {
+ emit_jump (default_label);
+ return;
+ }
/* Compute span of values. */
range = fold (build2 (MINUS_EXPR, index_type, maxval, minval));