diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-02-22 18:42:19 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-02-22 18:42:19 +0100 |
commit | 25c8b645eddd73483f4311b01e19e0196cf2c55b (patch) | |
tree | ff4a3f24095399451c11c77d283bf9056c4117bd | |
parent | 00c2f96f892c11adac80dfec452278e637f43f62 (diff) | |
download | gcc-25c8b645eddd73483f4311b01e19e0196cf2c55b.zip gcc-25c8b645eddd73483f4311b01e19e0196cf2c55b.tar.gz gcc-25c8b645eddd73483f4311b01e19e0196cf2c55b.tar.bz2 |
re PR other/5746 (0220 cvs crashes using undeclared type)
PR other/5746
* semantics.c (finish_switch_cond): Don't call get_unwidened
if error_mark_node.
From-SVN: r49969
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 21 |
2 files changed, 17 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 31fc320..bf470d1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2002-02-22 Jakub Jelinek <jakub@redhat.com> + + PR other/5746 + * semantics.c (finish_switch_cond): Don't call get_unwidened + if error_mark_node. + 2002-02-22 Nathan Sidwell <nathan@codesourcery.com> PR c++/2645, DR 295 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c344a30..e77e929 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -516,7 +516,6 @@ finish_switch_cond (cond, switch_stmt) tree orig_type = NULL; if (!processing_template_decl) { - tree type; tree index; /* Convert the condition to an integer or enumeration type. */ @@ -533,15 +532,17 @@ finish_switch_cond (cond, switch_stmt) cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond)); } - type = TREE_TYPE (cond); - index = get_unwidened (cond, NULL_TREE); - /* We can't strip a conversion from a signed type to an unsigned, - because if we did, int_fits_type_p would do the wrong thing - when checking case values for being in range, - and it's too hard to do the right thing. */ - if (TREE_UNSIGNED (TREE_TYPE (cond)) - == TREE_UNSIGNED (TREE_TYPE (index))) - cond = index; + if (cond != error_mark_node) + { + index = get_unwidened (cond, NULL_TREE); + /* We can't strip a conversion from a signed type to an unsigned, + because if we did, int_fits_type_p would do the wrong thing + when checking case values for being in range, + and it's too hard to do the right thing. */ + if (TREE_UNSIGNED (TREE_TYPE (cond)) + == TREE_UNSIGNED (TREE_TYPE (index))) + cond = index; + } } FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt)); SWITCH_TYPE (switch_stmt) = orig_type; |