backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested...
commit37e948410c67d1e4a0bb5bd3721b9fbf4d77f889
authorJakub Jelinek <jakub@redhat.com>
Fri, 14 Feb 2020 11:59:53 +0000 (14 12:59 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 14 Feb 2020 15:01:44 +0000 (14 16:01 +0100)
tree8b57bdc8068c615944f372617b16be7004275f71
parent41e5eec55cb64b54c717d9625bcee1aac1def569
backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)

Backported from mainline
2019-12-05  Jakub Jelinek  <jakub@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.
gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr92781.f90 [new file with mode: 0644]