]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in NEGATE_EXPR/BIT_NOT_E...
authorIan Lance Taylor <ian@airs.com>
Sun, 25 Sep 2005 03:05:57 +0000 (03:05 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sun, 25 Sep 2005 03:05:57 +0000 (03:05 +0000)
* convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in
NEGATE_EXPR/BIT_NOT_EXPR case.

From-SVN: r104615

gcc/ChangeLog
gcc/convert.c

index 25938ff74b2c437d5b0d226c3706c527713784d4..49321d41615009a40fa3d3cfda26614d601bcac3 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-24  Ian Lance Taylor  <ian@airs.com>
+
+       * convert.c (convert_to_integer): Don't test for ENUMERAL_TYPE in
+       NEGATE_EXPR/BIT_NOT_EXPR case.
+
 2005-09-24  Richard Henderson  <rth@redhat.com>
 
        * c-common.c (handle_mode_attribute): When not modifying in place,
index e5f8dcd76de235129672c535abf0eaa13ce8f1f7..5ddae361982ad43547b0a95d171bbf0e58a0811f 100644 (file)
@@ -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: