aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
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);
}