https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94978
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Paul Thomas <[email protected]>: https://gcc.gnu.org/g:0d6c71ab1635ac6182307b0c33c4e58f139b1a89 commit r14-12585-g0d6c71ab1635ac6182307b0c33c4e58f139b1a89 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)
