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

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Paul Thomas <[email protected]>:

https://gcc.gnu.org/g:005358093fd8566824b088d9bf7c8512ef5844fa

commit r15-11154-g005358093fd8566824b088d9bf7c8512ef5844fa
Author: Christopher Albert <[email protected]>
Date:   Sat Mar 28 17:26:05 2026 +0100

    fortran: Avoid bogus do-subscript warnings in skipped inner loops [PR94978]

    Do not warn from an outer-loop bound substitution when a nested inner loop
may
    be zero-trip after that substitution, because the guarded array reference
may
    then be unreachable.

    gcc/fortran/ChangeLog:

            PR fortran/94978
            * frontend-passes.cc (evaluate_loop_bound): New helper.
            (inner_loop_may_be_skipped): New helper.
            (do_subscript): Skip outer-loop bound warnings when nested inner
loops
            may be zero-trip for the substituted bound.

    gcc/testsuite/ChangeLog:

            PR fortran/94978
            * gfortran.dg/pr94978.f90: New test.

    Signed-off-by: Christopher Albert <[email protected]>
    (cherry picked from commit 790671b708400d1fc6bb1abbf1601f3616e8220d)

Reply via email to