[Bug tree-optimization/126549] [16/17 Regression] Wrong code with ranger and int->float casts since r16-1191

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 08:38:01 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126549

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

https://gcc.gnu.org/g:217df27883c450f3f098bd0d1dc1ea7d5dbe8ff8

commit r17-2924-g217df27883c450f3f098bd0d1dc1ea7d5dbe8ff8
Author: Jakub Jelinek <[email protected]>
Date:   Tue Aug 4 10:34:01 2026 +0200

    range-op-float: Remove inappropriate frange_drop_infs call [PR126549]

    For integer to floating conversions I've added frange_drop_infs
    call into the handler.  Supposedly I thought that integers converted
    to floating point are never +-inf, but that is clearly not the case
    as the testcases show.  For _Float16 it can be +-inf very easily,
    as the finite range is just [-65504.0f16,65504.0f16], for others
    all one needs is a large enough _BitInt.

    The following patch just drops that call.  In the common cases,
    +-inf will not appear in the range anyway, lb and ub will be usually
    finite.

    2026-08-04  Jakub Jelinek  <[email protected]>

            PR tree-optimization/126549
            * range-op-float.cc (operator_cast::fold_range): Don't call
            frange_drop_infs.

            * gcc.dg/torture/pr126549.c: New test.
            * gcc.dg/torture/bitint-107.c: New test.

    Reviewed-by: Aldy Hernandez <[email protected]>=