https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63665

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
To better bisect this also use -fno-tree-copy-prop (which otherwise hides
this on the 4.9 branch for example).

It's forwprop that does the bogus transform on

  y_5 = -2147483648;
  _6 = y_5 + -2147483648;

which ends up calling fold_binary (NE_EXPR, y_5 + -2147483648, 0) which
computes it as 1.

8769          tree new_const = int_const_binop (reverse_op, const2, const1);

results in -2147483648(OVF) even though we have -fwrapv in effect which
the triggers

      /* If the constant operation overflowed this can be
         simplified as a comparison against INT_MAX/INT_MIN.  */
      if (TREE_OVERFLOW (new_const))
        {

without changing how we compute TREE_OVERFLOW it seems that this test needs
to be guarded with !TYPE_OVERFLOW_WRAPS ().

Reply via email to