[Bug tree-optimization/126536] [13/14/15/16/17 Regression] ICE with -funswitch-loops

"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=126536

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

https://gcc.gnu.org/g:977fd87bade47e7624d803ba0cc549d819c03fe1

commit r17-3206-g977fd87bade47e7624d803ba0cc549d819c03fe1
Author: Andrew MacLeod <[email protected]>
Date:   Fri Aug 7 13:23:40 2026 -0400

    Allow range invert to fail.

    Return a boolean from range invert() to handle cases where an inversion
    cannot be represented.

            PR tree-optimization/126536
            gcc/
            * gimple-range-edge.cc (calc_switch_ranges): Check that invert
worked.
            * gimple-range-op.cc (cfn_toupper_tolower::fold_range): Likewise.
            * range-op-ptr.cc (operator_equal::op1_range): Likewise.
            (operator_not_equal::op1_range): Likewise.
            * range-op.cc (operator_equal::op1_range): Likewise.
            (operator_not_equal::op1_range): Likewise.
            (operator_rshift::op1_range): Likewise.
            (operator_logical_not::fold_range): Likewise.
            * tree-ssa-loop-unswitch.cc (unswitch_predicate): Likewise.
            * value-range.cc (irange_bitmask::range_from_mask): Likewise.
            (prange::invert): Return bool for success/fail.
            (irange::invert): Likewise.
            (irange::snap_subranges): Check that invert worked.
            (range_tests_int_range_max): Confirm failed invert works.
            (range_tests_misc): Check invert return value.
            * value-range.h (irange::invert): Add boolean return value.
            (prange::invert): Add boolean return value.
            * vr-values.cc (simplify_switch_using_ranges): Check invert result.

            gcc/testsuite/
            * gcc.dg/pr126536-1.c: New.
            * gcc.dg/pr126536-2.c: New.
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.