From: Jakub Jelinek Date: Sat, 19 Jan 2019 08:43:12 +0000 (+0100) Subject: re PR fortran/88902 (ICE: Segmentation fault (in DFS::DFS_write_tree_body)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=152f258f9a05d338a7e71c469e4e10fa02e038dd;p=gcc.git 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0d04224a71b..675ce39e21b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-01-19 Jakub Jelinek + + 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 PR fortran/43136 @@ -26,7 +32,7 @@ 2019-01-13 Thomas Koenig PR fortran/57992 - * trans-array.c (gfc_conv_array_parameter): Do not pack/unpack + * trans-array.c (gfc_conv_array_parameter): Do not pack/unpack functions with contiguous results. 2019-01-13 Thomas Koenig @@ -45,18 +51,18 @@ 2019-01-12 Paul Thomas - * gfortran.texi : Add description in sections on TS 29113 and + * gfortran.texi: Add description in sections on TS 29113 and further interoperability with C. * trans-array.c (gfc_conv_descriptor_attribute): New function. (gfc_get_dataptr_offset): Remove static function attribute. - * trans-array.h : Add prototypes for above functions. - * trans-decl.c : Add declarations for the library functions + * trans-array.h: Add prototypes for above functions. + * trans-decl.c: Add declarations for the library functions cfi_desc_to_gfc_desc and gfc_desc_to_cfi_desc. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): New function. (gfc_conv_procedure_call): Call it for scalar and array actual arguments, when the formal arguments are bind_c with assumed shape or assumed rank. - * trans.h : External declarations for gfor_fndecl_cfi_to_gfc + * trans.h: External declarations for gfor_fndecl_cfi_to_gfc and gfor_fndecl_gfc_to_cfi. 2019-01-11 Steven G. Kargl diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index c4cdcd68193..1fe11651816 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -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) - 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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 15abf4c6bb5..0e4a7784a51 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-19 Jakub Jelinek + + PR fortran/88902 + * gfortran.dg/pr88902.f90: New test. + 2019-01-18 Martin Sebor * c-c++-common/attr-nonstring-3.c: Remove an xfail. @@ -389,7 +394,7 @@ 2019-01-15 Paul Thomas - * gfortran.dg/ISO_Fortran_binding_2.c : Change reference to + * gfortran.dg/ISO_Fortran_binding_2.c: Change reference to ISO_Fortran_binding_2.h. 2019-01-15 Marek Polacek @@ -506,17 +511,17 @@ 2019-01-12 Paul Thomas - * gfortran.dg/ISO_Fortran_binding_2.f90 : Remove because of + * gfortran.dg/ISO_Fortran_binding_2.f90: Remove because of reports of ICEs. - * gfortran.dg/ISO_Fortran_binding_2.c : Ditto. + * gfortran.dg/ISO_Fortran_binding_2.c: Ditto. 2019-01-12 Paul Thomas - * gfortran.dg/ISO_Fortran_binding_1.f90 : New test. - * gfortran.dg/ISO_Fortran_binding_1.c : Auxilliary file for test. - * gfortran.dg/ISO_Fortran_binding_2.f90 : New test. - * gfortran.dg/ISO_Fortran_binding_2.c : Auxilliary file for test. - * gfortran.dg/bind_c_array_params_2.f90 : Change search string + * gfortran.dg/ISO_Fortran_binding_1.f90: New test. + * gfortran.dg/ISO_Fortran_binding_1.c: Auxilliary file for test. + * gfortran.dg/ISO_Fortran_binding_2.f90: New test. + * gfortran.dg/ISO_Fortran_binding_2.c: Auxilliary file for test. + * gfortran.dg/bind_c_array_params_2.f90: Change search string for dump tree scan. 2019-01-11 Steven G. Kargl diff --git a/gcc/testsuite/gfortran.dg/pr88902.f90 b/gcc/testsuite/gfortran.dg/pr88902.f90 new file mode 100644 index 00000000000..9e99b1be1dc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr88902.f90 @@ -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'