------- Comment #1 from rguenth at gcc dot gnu dot org  2010-02-09 12:32 -------
I am testing

Index: gcc/convert.c
===================================================================
--- gcc/convert.c       (revision 156620)
+++ gcc/convert.c       (working copy)
@@ -676,6 +676,7 @@ convert_to_integer (tree type, tree expr
        case MAX_EXPR:
        case MIN_EXPR:
        case MULT_EXPR:
+       case TRUNC_DIV_EXPR:
          {
            tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type);
            tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type);
Index: gcc/tree.c
===================================================================
--- gcc/tree.c  (revision 156620)
+++ gcc/tree.c  (working copy)
@@ -7623,6 +7623,14 @@ get_unwidened (tree op, tree for_type)
        }
     }

+  /* If we finally reach a constant see if it fits in for_type and
+     in that case convert it.  */
+  if (for_type
+      && TREE_CODE (win) == INTEGER_CST
+      && TREE_TYPE (win) != for_type
+      && int_fits_type_p (win, for_type))
+    win = fold_convert (for_type, win);
+
   return win;
 }



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-09 12:32:20
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43007

Reply via email to