+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.
+
2019-12-04 Tobias Burnus <tobias@codesourcery.com>
PR fortran/92754
/* 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);
}
+2019-12-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/92781
+ * gfortran.dg/pr92781.f90: New test.
+
2019-12-05 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/diagnostic/functional-cast-to-array-type-1.C: New.