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 target/67771] New: integer-to-floating-point conversions wrongly produce -0 in FE_DOWNWARD mode


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

            Bug ID: 67771
           Summary: integer-to-floating-point conversions wrongly produce
                    -0 in FE_DOWNWARD mode
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jsm28 at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc*-*-*

For older powerpc processors without support for fcfid in 32-bit code,
integer-to-floating-point conversions involve constructing a floating-point
representation, loading it into a floating-point register and subtracting a
constant.  In FE_DOWNWARD mode, if the integer is 0 then the result is -0, but
integer 0 should always convert for +0.  That is, this code is incorrect for
-frounding-math, and some other code sequence allowing for that should be
generated in that case (whether saving and restoring the rounding mode like
some other code generated by the powerpc back end does, or special-casing a
check for 0).

This results in incorrect returns from some glibc functions such as logb.


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