re PR middle-end/66984 (ICE: fold_binary changes type of operand, causing failure...
authorGary Funck <gary@intrepid.com>
Fri, 24 Jul 2015 16:10:39 +0000 (16:10 +0000)
committerGary Funck <gfunck@gcc.gnu.org>
Fri, 24 Jul 2015 16:10:39 +0000 (16:10 +0000)
2015-07-24  Gary Funck  <gary@intrepid.com>

PR middle-end/66984
* fold-const.c (fold_binary_loc): Call fold_convert on arguments to
        fold_build2 for CEIL_DIV_EXPR and FLOOR_DIV_EXPR optimization.

From-SVN: r226168

gcc/ChangeLog
gcc/fold-const.c

index 59910bf992ff86fd5903e4188094f01e3609825a..fc7bd761fcbd9c695bc745466309b44855ccf6fb 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-24  Gary Funck  <gary@intrepid.com>
+
+       PR middle-end/66984
+       * fold-const.c (fold_binary_loc): Call fold_convert on arguments to
+        fold_build2 for CEIL_DIV_EXPR and FLOOR_DIV_EXPR optimization.
+
 2015-07-24  Tom de Vries  <tom@codesourcery.com>
 
        * tree-parloops.c (gen_parallel_loop): Add debug print for alternative
index 739a3a98e29e73a95f1686f10cf7cc9dbd292b84..e69b1d041337af3dfeb1457edd585a3e77e801e4 100644 (file)
@@ -10746,7 +10746,9 @@ fold_binary_loc (location_t loc,
         after the last round to changes to the DIV code in expmed.c.  */
       if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR)
          && multiple_of_p (type, arg0, arg1))
-       return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, arg1);
+       return fold_build2_loc (loc, EXACT_DIV_EXPR, type,
+                               fold_convert (type, arg0),
+                               fold_convert (type, arg1));
 
       strict_overflow_p = false;
       if (TREE_CODE (arg1) == INTEGER_CST