From bfe936c0c1f9592f72aa5d5f9f84a94ef507b9ec Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 23 Apr 2005 12:38:08 +0000 Subject: [PATCH] Fix bug that causes testsuite failure in namelist_13.f90 on some systems. Co-Authored-By: Jerry DeLisle From-SVN: r98610 --- libgfortran/ChangeLog | 9 +++++++++ libgfortran/io/list_read.c | 5 +++-- libgfortran/io/write.c | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 66ecfd0..027ad27 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2005-04-18 Paul Thomas + Jerry DeLisle + + * io/write.c (nml_write_obj): Provide 1 more byte for ext_name. + * io/list_read.c (nml_get_obj_data): Put extra brackets in get_mem + call for ext_name. These fix the bug reported by Jerry DeLisle to + the fortran list and are based on his suggested fix. + + 2005-04-22 Thomas Koenig PR libfortran/20074 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index bc592dd..28def56 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2107,8 +2107,9 @@ get_name: if (component_flag) { - ext_name = (char*)get_mem (strlen (root_nl->var_name) + - saved_string ? strlen (saved_string) : 0 + 1); + ext_name = (char*)get_mem (strlen (root_nl->var_name) + + (saved_string ? strlen (saved_string) : 0) + + 1); strcpy (ext_name, root_nl->var_name); strcat (ext_name, saved_string); nl = find_nml_node (ext_name); diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index c57ebac..faf8b90 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1477,7 +1477,8 @@ nml_write_obj (namelist_info * obj, index_type offset, ext_name = (char*)get_mem ( (base_name ? strlen (base_name) : 0) + (base ? strlen (base->var_name) : 0) + strlen (obj->var_name) - + obj->var_rank * NML_DIGITS); + + obj->var_rank * NML_DIGITS + + 1); strcpy(ext_name, base_name ? base_name : ""); clen = base ? strlen (base->var_name) : 0; -- 2.7.4