[Bug tree-optimization/126637] [17 Regression] wrong code at -O{s,2,3} with -fwhole-program on x86_64-linux-gnu

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126637

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <[email protected]>:

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

commit r17-3038-gb9c9f9350ca8cb8d0a59cb99b5e48f6f7328adc6
Author: Aldy Hernandez <[email protected]>
Date:   Thu Aug 6 07:01:38 2026 +0000

    Handle sub-ranges in frange == and != operators [PR126637]

    When the operands do not intersect, == and != still allow equality if
    each range holds a zero of opposite sign, hence -0.0 == 0.0.  The
    check for this looked at the hull endpoints, ignoring the inner
    sub-range boundaries.  With sub-ranges the zero can be inner,
    e.g. [-1.0, -0.0][1.0, 1.0] with hull [-1.0, 1.0], so it was missed
    and e.g. "e != 0.0" folded to true.

    Tested on ppc64le Linux: regstrap and LAPACK.

            PR tree-optimization/126637

    gcc/ChangeLog:

            * range-op-float.cc (operator_equal::fold_range): Use the
            contains_zero_p method to detect a contained zero instead of
            inspecting the hull endpoints.
            (operator_not_equal::fold_range): Likewise.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr126637.c: New test.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.