]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fold: Fix up merge_truthop_with_opposite_arm for NaNs [PR95351]
authorAndrew Pinski <quic_apinski@quicinc.com>
Sun, 10 Mar 2024 22:17:09 +0000 (22:17 +0000)
committerAndrew Pinski <quic_apinski@quicinc.com>
Tue, 12 Mar 2024 04:08:26 +0000 (21:08 -0700)
commitac96973150b3279fe157f160efd83995077c7590
treec7a6b0b7fdc4bfdc7daed83a0f0d6c548b36a3e0
parent4bd9d097197334e786690ba1566ccf79396da730
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 <quic_apinski@quicinc.com>
(cherry picked from commit 31ce2e993d09dcad1ce139a2848a28de5931056d)
gcc/fold-const.cc
gcc/testsuite/gcc.dg/float_opposite_arm-1.c [new file with mode: 0644]