diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2005-02-18 12:20:49 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2005-02-18 12:20:49 +0000 |
commit | 2aabee29e107c927902a9a62b2328f88db17d993 (patch) | |
tree | a9c7d9f0218df9d72684d8174c257d1e35351b39 /gcc/stmt.c | |
parent | aeba6c285a2b7da7ee090cc51d3e96838b567398 (diff) | |
download | gcc-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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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)); |