[Bug target/70333] [5/6 Regression] Test miscompiled with -O0.

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 21 11:45:00 GMT 2016


--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
4.9 had

      if (tcode == code)
          double_int mul;
          bool overflow_p;
          unsigned prec = TYPE_PRECISION (ctype);
          bool uns = TYPE_UNSIGNED (ctype);
          double_int diop1 = tree_to_double_int (op1).ext (prec, uns);
          double_int dic = tree_to_double_int (c).ext (prec, uns);
          mul = diop1.mul_with_sign (dic, false, &overflow_p);
          overflow_p = ((!uns && overflow_p)
                        | TREE_OVERFLOW (c) | TREE_OVERFLOW (op1));
          if (!double_int_fits_to_tree_p (ctype, mul)
              && ((uns && tcode != MULT_EXPR) || !uns))
            overflow_p = 1;
          if (!overflow_p)
            return fold_build2 (tcode, ctype, fold_convert (ctype, op0),
                                double_int_to_tree (ctype, mul));

where double_int_to_tree does not do any kind of extension.  Given it
unconditonally uses an unsinged multiplication you can see it as a

More information about the Gcc-bugs mailing list