summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2005-09-25 03:05:57 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2005-09-25 03:05:57 +0000
commit1f6f3d15c62ea39da28c60064ffd61e0eb87abc5 (patch)
tree585707c17b131bfa3305c664f46a1124a7613b50 /gcc/convert.c
parent8028abd70df73eb9705ffeb1c5811d535940bfc5 (diff)
downloadgcc-1f6f3d15c62ea39da28c60064ffd61e0eb87abc5.tar.gz
convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in NEGATE_EXPR/BIT_NOT_EXPR case.
* convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in NEGATE_EXPR/BIT_NOT_EXPR case. From-SVN: r104615
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index e5f8dcd76de..5ddae361982 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: