> Am 03.08.2026 um 19:40 schrieb Roger Sayle <[email protected]>:
>
>
> Hi Richard,
> Here's the latest revision of my patch to resolve PR 126242 (and 126325),
> incorporating Richard Biener's feedback to simplify the logic, eliminating
> itype_ok and always using calling gimple_match_range_of_expr. This
> version also resolves PR tree-optimization/126325 introduced/exposed
> by the same change, checking that when transforming (float)x < C into
> x < (int)C that (int)C is exactly representable, i.e. that (float)(int)C ==
> C.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check, both with and without --target_board=unix{-m32}
> with no new failures. Ok for mainline?
Ok
Thanks,
Richard
>
> 2026-08-03 Roger Sayle <[email protected]>
> Richard Biener <[email protected]>
>
> gcc/ChangeLog
> PR tree-optimization/126242
> PR tree-optimization/126325
> * match.pd ((FTYPE) N CMP CST): Always attempt to initialize
> value range information. Check undefined_p before using range
> bounds. Check that icst_val hasn't overflowed, i.e. that
> (FTYPE)ICST == CST, before transforming to integer comparison.
>
> gcc/testsuite/ChangeLog
> PR tree-optimization/126242
> PR tree-optimization/126325
> * gcc.dg/pr126325.c: New test case.
> * gfortran.dg/pr126242.f90: New reduced test case.
> * gfortran.dg/pr41928-2.f90: Also compile pr41928.f90 with -Ofast.
>
> Thanks again.
> Roger
> --
>
> <patchvr2.txt>