From 661635f2e71bc4a817105d9b7c4427289f844d78 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 25 Sep 2005 03:05:57 +0000 Subject: [PATCH] * convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in NEGATE_EXPR/BIT_NOT_EXPR case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104615 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/convert.c | 36 ++++++++++++------------------------ 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25938ff..49321d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-09-24 Ian Lance Taylor + + * convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in + NEGATE_EXPR/BIT_NOT_EXPR case. + 2005-09-24 Richard Henderson * c-common.c (handle_mode_attribute): When not modifying in place, diff --git a/gcc/convert.c b/gcc/convert.c index e5f8dcd..5ddae36 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -620,30 +620,18 @@ convert_to_integer (tree type, tree expr) /* This is not correct for ABS_EXPR, since we must test the sign before truncation. */ { - tree typex = type; - - /* Can't do arithmetic in enumeral types - so use an integer type that will hold the values. */ - if (TREE_CODE (typex) == ENUMERAL_TYPE) - typex = lang_hooks.types.type_for_size - (TYPE_PRECISION (typex), TYPE_UNSIGNED (typex)); - - /* But now perhaps TYPEX is as wide as INPREC. - In that case, do nothing special here. - (Otherwise would recurse infinitely in convert. */ - if (TYPE_PRECISION (typex) != inprec) - { - /* Don't do unsigned arithmetic where signed was wanted, - or vice versa. */ - if (TYPE_UNSIGNED (TREE_TYPE (expr))) - typex = lang_hooks.types.unsigned_type (typex); - else - typex = lang_hooks.types.signed_type (typex); - return convert (type, - fold_build1 (ex_form, typex, - convert (typex, - TREE_OPERAND (expr, 0)))); - } + tree typex; + + /* Don't do unsigned arithmetic where signed was wanted, + or vice versa. */ + if (TYPE_UNSIGNED (TREE_TYPE (expr))) + typex = lang_hooks.types.unsigned_type (type); + else + typex = lang_hooks.types.signed_type (type); + return convert (type, + fold_build1 (ex_form, typex, + convert (typex, + TREE_OPERAND (expr, 0)))); } case NOP_EXPR: -- 2.7.4