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

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

https://gcc.gnu.org/g:2cb095ea4ec175bc95cb06ae604e6401ce74ca91

commit r13-10307-g2cb095ea4ec175bc95cb06ae604e6401ce74ca91
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