This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch,libgfortran] Fix for testsuite failure in namelist_13.f90
- From: "Paul Thomas" <paulthomas2 at wanadoo dot fr>
- To: "patch" <gcc-patches at gcc dot gnu dot org>, <fortran at gcc dot gnu dot org>
- Cc: "Jerry DeLisle" <jvdelisle at verizon dot net>
- Date: Sat, 23 Apr 2005 14:44:56 +0200
- Subject: [Patch,libgfortran] Fix for testsuite failure in namelist_13.f90
Bootstrapped and regtested - Committed as obvious.
(The patch has the correct tabbing - W*****s E******r drops the lot -
sorry.)
2005-04-18 Paul Thomas <pault@gcc.gnu.org>
Jerry DeLisle <jvdelisle@verizon.net>
* 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.
Index: list_read.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/list_read.c,v
retrieving revision 1.17
diff -p -c -3 -r1.17 list_read.c
*** list_read.c 18 Apr 2005 22:19:27 -0000 1.17
--- list_read.c 23 Apr 2005 12:34:36 -0000
*************** get_name:
*** 2107,2114 ****
if (component_flag)
{
! 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);
--- 2107,2115 ----
if (component_flag)
{
! 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);
Index: write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.32
diff -p -c -3 -r1.32 write.c
*** write.c 17 Apr 2005 20:09:37 -0000 1.32
--- write.c 23 Apr 2005 12:34:38 -0000
*************** nml_write_obj (namelist_info * obj, inde
*** 1477,1483 ****
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);
strcpy(ext_name, base_name ? base_name : "");
clen = base ? strlen (base->var_name) : 0;
--- 1477,1484 ----
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
! + 1);
strcpy(ext_name, base_name ? base_name : "");
clen = base ? strlen (base->var_name) : 0;