2019-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2019-01-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/88902
+ * trans-decl.c (gfc_get_symbol_decl): Don't add length to function
+ or parent function if it has been added there already.
+
2018-12-07 Jakub Jelinek <jakub@redhat.com>
PR fortran/88377
if (VAR_P (length) && DECL_FILE_SCOPE_P (length))
{
/* Add the string length to the same context as the symbol. */
- if (DECL_CONTEXT (sym->backend_decl) == current_function_decl)
- gfc_add_decl_to_function (length);
- else
- gfc_add_decl_to_parent_function (length);
+ if (DECL_CONTEXT (length) == NULL_TREE)
+ {
+ if (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 (DECL_CONTEXT (sym->backend_decl)
+ == DECL_CONTEXT (length));
gfc_defer_symbol_init (sym);
}
2019-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2019-01-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/88902
+ * gfortran.dg/pr88902.f90: New test.
+
2019-01-17 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/88870