https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98490
--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Harald Anlauf <anl...@gcc.gnu.org>: https://gcc.gnu.org/g:c38626f7a66dea400e54f671bfe32dc46e11ad44 commit r10-10131-gc38626f7a66dea400e54f671bfe32dc46e11ad44 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)