summaryrefslogtreecommitdiffstats
path: root/libgfortran/io
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-23 12:38:08 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-23 12:38:08 +0000
commitfceb0385226d413b174f495655585ec95743f754 (patch)
treead6a26c4b642d29a0bd377578e9ca91e08eab98a /libgfortran/io
parentf069f126871fbd2a35378b13ed3da86c3c9db20b (diff)
downloadppe42-gcc-fceb0385226d413b174f495655585ec95743f754.tar.gz
ppe42-gcc-fceb0385226d413b174f495655585ec95743f754.zip
Fix bug that causes testsuite failure in namelist_13.f90 on some systems.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98610 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/list_read.c5
-rw-r--r--libgfortran/io/write.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index bc592ddcc12..28def564278 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 c57ebac6219..faf8b90d4f6 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;
OpenPOWER on IntegriCloud