Both premature (can't find or think of an existing place that would
rely on those) and bogus, - (4 /[fl] 5) isn't equal to (4 /[fl] -5).
Removing and not trying to fold into 4 /[cl] -5 as we have no good
way of creating testcases (that also include the negation).

Bootstrap / regtest on x86_64-unknown-linux-gnu pending.

Ok for trunk? (not a regression AFAIK)

Thanks,
Richard.

2014-04-11  Richard Biener  <rguent...@suse.de>

        PR middle-end/55022
        * fold-const.c (negate_expr_p): Don't negate directional rounding
        division.
        (fold_negate_expr): Likewise.

Index: gcc/fold-const.c
===================================================================
*** gcc/fold-const.c    (revision 209292)
--- gcc/fold-const.c    (working copy)
*************** negate_expr_p (tree t)
*** 484,491 ****
  
      case TRUNC_DIV_EXPR:
      case ROUND_DIV_EXPR:
-     case FLOOR_DIV_EXPR:
-     case CEIL_DIV_EXPR:
      case EXACT_DIV_EXPR:
        /* In general we can't negate A / B, because if A is INT_MIN and
         B is 1, we may turn this into INT_MIN / -1 which is undefined
--- 484,489 ----
*************** fold_negate_expr (location_t loc, tree t
*** 682,689 ****
  
      case TRUNC_DIV_EXPR:
      case ROUND_DIV_EXPR:
-     case FLOOR_DIV_EXPR:
-     case CEIL_DIV_EXPR:
      case EXACT_DIV_EXPR:
        /* In general we can't negate A / B, because if A is INT_MIN and
         B is 1, we may turn this into INT_MIN / -1 which is undefined
--- 680,685 ----

Reply via email to