re PR fortran/88902 (ICE: Segmentation fault (in DFS::DFS_write_tree_body))

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.

	* gfortran.dg/pr88902.f90: New test.

From-SVN: r268091
This commit is contained in:
Jakub Jelinek 2019-01-19 09:43:12 +01:00
parent 1f7c5604c8
commit 152f258f9a
4 changed files with 40 additions and 19 deletions

View File

@ -1,3 +1,9 @@
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.
2019-01-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/43136

View File

@ -1572,13 +1572,17 @@ gfc_get_symbol_decl (gfc_symbol * sym)
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)
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);
}

View File

@ -1,3 +1,8 @@
2019-01-19 Jakub Jelinek <jakub@redhat.com>
PR fortran/88902
* gfortran.dg/pr88902.f90: New test.
2019-01-18 Martin Sebor <msebor@redhat.com>
* c-c++-common/attr-nonstring-3.c: Remove an xfail.

View File

@ -0,0 +1,6 @@
! PR fortran/88902
! { dg-do compile }
! { dg-require-effective-target lto }
! { dg-options "-flto --param ggc-min-heapsize=0" }
include 'pr50069_2.f90'