https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94978
--- Comment #12 from Christopher Albert <albert at tugraz dot at> --- Created attachment 64061 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64061&action=edit [PATCH] fortran: Avoid bogus do-subscript warnings in skipped inner loops [PR94978] Patch attached. The bogus warning comes from treating an outer-loop bound substitution as executed even when a nested inner loop becomes zero-trip for that substituted bound. This patch checks the nested inner loops first and suppresses the warning when the guarded array reference may be unreachable. Regtested on x86_64-pc-linux-gnu with: - make -C gcc-build-pr94978/gcc check-gfortran RUNTESTFLAGS='dg.exp=pr94978.f90' - make -C gcc-build-pr94978/gcc check-gfortran RUNTESTFLAGS='dg.exp=minmax_char_1.f90' - make -C gcc-build-pr94978/gcc check-gfortran RUNTESTFLAGS='dg.exp=bind-c-contiguous-4.f90' - make -C gcc-build-pr94978/gcc -j32 -k check-gfortran - make -C gcc-build-pr94978 -j32 check-target-libgomp-fortran All passed.
