This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/55771] Negation and type conversion incorrectly exchanged


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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-21 13:55:41 UTC ---
Or rather convert.c:convert_to_real:

  /* Propagate the cast into the operation.  */
  if (itype != type && FLOAT_TYPE_P (type))
    switch (TREE_CODE (expr))
      {
        /* Convert (float)-x into -(float)x.  This is safe for
           round-to-nearest rounding mode.  */
        case ABS_EXPR:
        case NEGATE_EXPR:
          if (!flag_rounding_math
              && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr)))
            return build1 (TREE_CODE (expr), type,
                           fold (convert_to_real (type,
                                                  TREE_OPERAND (expr, 0))));
          break;

that's of course not valid for unsigned x, even when using ufloat, as the
float result is always signed.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]