aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2019-01-19 09:43:12 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-19 09:43:12 +0100
commit152f258f9a05d338a7e71c469e4e10fa02e038dd (patch)
tree1a6927f8afaa108a82f54596a1ae8d15e2ed572c /gcc/fortran
parent1f7c5604c8be5d0f3025ec1abcdfb11230d7f4cd (diff)
downloadgcc-152f258f9a05d338a7e71c469e4e10fa02e038dd.zip
gcc-152f258f9a05d338a7e71c469e4e10fa02e038dd.tar.gz
gcc-152f258f9a05d338a7e71c469e4e10fa02e038dd.tar.bz2
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
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog16
-rw-r--r--gcc/fortran/trans-decl.c16
2 files changed, 21 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0d04224..675ce39 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
@@ -26,7 +32,7 @@
2019-01-13 Thomas Koenig <tkoenig@gcc.gnu.org>
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 <tkoenig@gcc.gnu.org>
@@ -45,18 +51,18 @@
2019-01-12 Paul Thomas <pault@gcc.gnu.org>
- * 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 <kargl@gcc.gnu.org>
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index c4cdcd6..1fe1165 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);
}