[Bug middle-end/61876] Converting __builtin_round + cast into __builtin_lround is not always equivalent in regards to math errno

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 23 12:19:00 GMT 2014


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-07-23
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interestingly my manual page says

ERRORS
       See math_error(7) for information on how to determine whether an  error
       has occurred when calling these functions.

       The following errors can occur:

       Domain error: x is a NaN or infinite, or the rounded value is too large
              An invalid floating-point exception (FE_INVALID) is raised.

       These functions do not set errno.

But C99 specifies only that the functions may raise a 'range error' (as
opposed to a domain error).

That said - 'errno' handling is a tricky area...

Confirmed.  The fix is to properly guard the transform, calling a function
that the may set errno is wrong-code.



More information about the Gcc-bugs mailing list