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

--- Comment #31 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <al...@gcc.gnu.org>:

https://gcc.gnu.org/g:844190af178c210a6aff6b7eb4dd8c6a49210ff9

commit r13-5179-g844190af178c210a6aff6b7eb4dd8c6a49210ff9
Author: Aldy Hernandez <al...@redhat.com>
Date:   Tue Jan 10 10:57:16 2023 +0100

    [PR107608] [range-ops] Avoid folding into INF when flag_trapping_math.

    As discussed in the PR, for trapping math, do not fold overflowing
    operations into +-INF as doing so could elide a trap.

    There is a minor adjustment to known_isinf() where it was mistakenly
    returning true for an [infinity U NAN], whereas it should only return
    true when the range is exclusively +INF or -INF.  This is benign, as
    there were no users of known_isinf up to now.

    Tested on x86-64 Linux.

    I also ran the glibc testsuite (git sources) on x86-64 and this patch
    fixes:

    -FAIL: math/test-double-lgamma
    -FAIL: math/test-double-log1p
    -FAIL: math/test-float-lgamma
    -FAIL: math/test-float-log1p
    -FAIL: math/test-float128-catan
    -FAIL: math/test-float128-catanh
    -FAIL: math/test-float128-lgamma
    -FAIL: math/test-float128-log
    -FAIL: math/test-float128-log1p
    -FAIL: math/test-float128-y0
    -FAIL: math/test-float128-y1
    -FAIL: math/test-float32-lgamma
    -FAIL: math/test-float32-log1p
    -FAIL: math/test-float32x-lgamma
    -FAIL: math/test-float32x-log1p
    -FAIL: math/test-float64-lgamma
    -FAIL: math/test-float64-log1p
    -FAIL: math/test-float64x-lgamma
    -FAIL: math/test-ldouble-lgamma

            PR tree-optimization/107608

    gcc/ChangeLog:

            * range-op-float.cc (range_operator_float::fold_range): Avoid
            folding into INF when flag_trapping_math.
            * value-range.h (frange::known_isinf): Return false for possible
NANs.

Reply via email to