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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Vadim Zeitlin from comment #3)
> (In reply to Andrew Pinski from comment #1)
> > You want -frounding-math
> 
> OK, thanks, this does indeed solve my immediate problem. However is it
> really normal that the compiler behaviour silently (!) changes like this, in
> backwards incompatible way between versions? I didn't remember seeing this
> change mentioned in gcc 6 release notes and I just reread them again and
> can't find it anywhere. I think changes silently breaking existing working
> (and standard conforming) code should be at the very least prominently
> documented (and, of course, ideally completely avoided IMO, but this ship
> has probably already sailed).

Yes and no.  Since this behavior has been documented this way since 4.4.0:
https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Optimize-Options.html
-frounding-math
Disable transformations and optimizations that assume default floating point
rounding behavior. This is round-to-zero for all floating point to integer
conversions, and round-to-nearest for all other arithmetic truncations. ___This
option should be specified for programs that change the FP rounding mode
dynamically, or that may be executed with a non-default rounding mode.____ This
option disables constant folding of floating point expressions at compile-time
(which may be affected by rounding mode) and arithmetic transformations that
are unsafe in the presence of sign-dependent rounding modes.

Note I add ___.  So basically what changed between 5 and 6 was constant folding
of rint.  Since that is covered in the documentation, the change itself does
not need to be documented as happening.

Reply via email to