https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98490
--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Harald Anlauf <anl...@gcc.gnu.org>: https://gcc.gnu.org/g:97a5a41dbfef1722fdaf4dc979e8b9c274b4404d commit r9-9750-g97a5a41dbfef1722fdaf4dc979e8b9c274b4404d Author: Harald Anlauf <anl...@gmx.de> Date: Thu Sep 9 21:34:01 2021 +0200 Fortran - out of bounds in array constructor with implied do loop gcc/fortran/ChangeLog: PR fortran/98490 * trans-expr.c (gfc_conv_substring): Do not generate substring bounds check for implied do loop index variable before it actually becomes defined. gcc/testsuite/ChangeLog: PR fortran/98490 * gfortran.dg/bounds_check_23.f90: New test. (cherry picked from commit 5fe0865ab788bdc387b284a3ad57e5a95a767b18)