https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92781
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Fri Dec 20 17:36:08 2019 New Revision: 279667 URL: https://gcc.gnu.org/viewcvs?rev=279667&root=gcc&view=rev Log: Backported from mainline 2019-12-05 Jakub Jelinek <ja...@redhat.com> PR fortran/92781 * trans-decl.c (gfc_get_symbol_decl): If sym->backend_decl is current_function_decl, add length to current rather than parent function and expect DECL_CONTEXT (length) to be current_function_decl. * gfortran.dg/pr92781.f90: New test. Added: branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr92781.f90 Modified: branches/gcc-9-branch/gcc/fortran/ChangeLog branches/gcc-9-branch/gcc/fortran/trans-decl.c branches/gcc-9-branch/gcc/testsuite/ChangeLog