aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-12-05 10:03:34 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-12-05 10:03:34 +0100
commitd0c4f314cfd1fcdf85fb8f2661a8a741447772f8 (patch)
tree9c926dee521afc347ac9aed2262e27ebdae29077 /gcc/fortran/trans-decl.c
parentad774d0d6351789e9e412291cf280c8e3f72bf81 (diff)
downloadgcc-d0c4f314cfd1fcdf85fb8f2661a8a741447772f8.zip
gcc-d0c4f314cfd1fcdf85fb8f2661a8a741447772f8.tar.gz
gcc-d0c4f314cfd1fcdf85fb8f2661a8a741447772f8.tar.bz2
re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)
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. From-SVN: r278988
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index e742447..fb15396 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1631,15 +1631,18 @@ gfc_get_symbol_decl (gfc_symbol * sym)
/* Add the string length to the same context as the symbol. */
if (DECL_CONTEXT (length) == NULL_TREE)
{
- if (DECL_CONTEXT (sym->backend_decl)
- == current_function_decl)
+ if (sym->backend_decl == current_function_decl
+ || (DECL_CONTEXT (sym->backend_decl)
+ == current_function_decl))
gfc_add_decl_to_function (length);
else
gfc_add_decl_to_parent_function (length);
}
- gcc_assert (DECL_CONTEXT (sym->backend_decl)
- == DECL_CONTEXT (length));
+ gcc_assert (sym->backend_decl == current_function_decl
+ ? DECL_CONTEXT (length) == current_function_decl
+ : (DECL_CONTEXT (sym->backend_decl)
+ == DECL_CONTEXT (length)));
gfc_defer_symbol_init (sym);
}