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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sa...@gcc.gnu.org>:

https://gcc.gnu.org/g:72c243017dee611bf3c32ea7bfad6ac538021aaf

commit r12-7621-g72c243017dee611bf3c32ea7bfad6ac538021aaf
Author: Roger Sayle <ro...@nextmovesoftware.com>
Date:   Sat Mar 12 09:20:52 2022 +0000

    PR middle-end/98420: Don't fold x - x to 0.0 with -frounding-math

    This patch addresses PR middle-end/98420, which is inappropriate constant
    folding of x - x to 0.0 (in match.pd) when -frounding-math is specified.
    Specifically, x - x may be -0.0 with FE_DOWNWARD as the rounding mode.

    To summarize, the desired IEEE behaviour, x - x for floating point x,
    (1) can't be folded to 0.0 by default, due to the possibility of NaN or Inf
    (2) can be folded to 0.0 with -ffinite-math-only
    (3) can't be folded to 0.0 with -ffinite-math-only -frounding-math
    (4) can be folded with -ffinite-math-only -frounding-math -fno-signed-zeros

    2022-03-12  Roger Sayle  <ro...@nextmovesoftware.com>

    gcc/ChangeLog
            PR middle-end/98420
            * match.pd (minus @0 @0): Additional checks for -fno-rounding-math
            (the defaut) or -fno-signed-zeros.

    gcc/testsuite/ChangeLog
            PR middle-end/98420
            * gcc.dg/pr98420.c: New test case.

Reply via email to