[Bug middle-end/95351] [11/12 Regression] Comparison with NAN optimizes incorrectly with -ffast-math disabled

2024-05-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95351

Andrew Pinski  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||12.3.1, 14.1.0
 Resolution|--- |FIXED

--- Comment #11 from Andrew Pinski  ---
Fixed everywhere now.

[Bug middle-end/95351] [11/12 Regression] Comparison with NAN optimizes incorrectly with -ffast-math disabled

2024-05-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95351

--- Comment #10 from GCC Commits  ---
The releases/gcc-11 branch has been updated by Andrew Pinski
:

https://gcc.gnu.org/g:6c00c3245e688d00dae3e928f0d03f530640caae

commit r11-11420-g6c00c3245e688d00dae3e928f0d03f530640caae
Author: Andrew Pinski 
Date:   Sun Mar 10 22:17:09 2024 +

Fold: Fix up merge_truthop_with_opposite_arm for NaNs [PR95351]

The problem here is that merge_truthop_with_opposite_arm would
use the type of the result of the comparison rather than the operands
of the comparison to figure out if we are honoring NaNs.
This fixes that oversight and now we get the correct results in this
case.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

PR middle-end/95351

gcc/ChangeLog:

* fold-const.c (merge_truthop_with_opposite_arm): Use
the type of the operands of the comparison and not the type
of the comparison.

gcc/testsuite/ChangeLog:

* gcc.dg/float_opposite_arm-1.c: New test.

Signed-off-by: Andrew Pinski 
(cherry picked from commit 31ce2e993d09dcad1ce139a2848a28de5931056d)

[Bug middle-end/95351] [11/12 Regression] Comparison with NAN optimizes incorrectly with -ffast-math disabled

2024-05-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95351

--- Comment #9 from GCC Commits  ---
The releases/gcc-12 branch has been updated by Andrew Pinski
:

https://gcc.gnu.org/g:d88fe8210e4edc2f4ddf722ba788924452c6f6a0

commit r12-10430-gd88fe8210e4edc2f4ddf722ba788924452c6f6a0
Author: Andrew Pinski 
Date:   Sun Mar 10 22:17:09 2024 +

Fold: Fix up merge_truthop_with_opposite_arm for NaNs [PR95351]

The problem here is that merge_truthop_with_opposite_arm would
use the type of the result of the comparison rather than the operands
of the comparison to figure out if we are honoring NaNs.
This fixes that oversight and now we get the correct results in this
case.

Committed as obvious after a bootstrap/test on x86_64-linux-gnu.

PR middle-end/95351

gcc/ChangeLog:

* fold-const.cc (merge_truthop_with_opposite_arm): Use
the type of the operands of the comparison and not the type
of the comparison.

gcc/testsuite/ChangeLog:

* gcc.dg/float_opposite_arm-1.c: New test.

Signed-off-by: Andrew Pinski 
(cherry picked from commit 31ce2e993d09dcad1ce139a2848a28de5931056d)

[Bug middle-end/95351] [11/12 Regression] Comparison with NAN optimizes incorrectly with -ffast-math disabled

2024-03-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95351

Andrew Pinski  changed:

   What|Removed |Added

Summary|[11/12/13 Regression]   |[11/12 Regression]
   |Comparison with NAN |Comparison with NAN
   |optimizes incorrectly with  |optimizes incorrectly with
   |-ffast-math disabled|-ffast-math disabled
  Known to work||13.2.1

--- Comment #8 from Andrew Pinski  ---
Also fixed for GCC 13.3.0.