]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/45710 (Adjust format and padding for WRITE of NAMELIST group...
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Thu, 7 Oct 2010 02:31:14 +0000 (02:31 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Thu, 7 Oct 2010 02:31:14 +0000 (02:31 +0000)
2010-10-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

Backport from mainline:
PR libfortran/45710
* io/write.c (namelist_write_newline): Pad character array internal
unit records with spaces.

From-SVN: r165079

libgfortran/ChangeLog
libgfortran/io/write.c

index ef668b8c770ef3e314e4f7a64d7157d40b6c1bc8..031bc7ae5a3f6c58903782f47be1050063e585a6 100644 (file)
@@ -1,3 +1,10 @@
+2010-10-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       Backport from mainline:
+       PR libfortran/45710
+       * io/write.c (namelist_write_newline): Pad character array internal
+       unit records with spaces.
+
 2010-10-01  Release Manager
 
        * GCC 4.4.5 released.
index b6d6e687736dab543896ac1375dfac38a2986a39..730f08173c8c9385e550b8bf6d0f354c676b7a16 100644 (file)
@@ -1194,10 +1194,15 @@ namelist_write_newline (st_parameter_dt *dtp)
   if (is_array_io (dtp))
     {
       gfc_offset record;
-      int finished, length;
+      int finished;
+      char *p;
+      int length = dtp->u.p.current_unit->bytes_left;
+
+      p = write_block (dtp, length);
+      if (p == NULL)
+       return;
+      memset (p, ' ', length);
 
-      length = (int) dtp->u.p.current_unit->bytes_left;
-             
       /* Now that the current record has been padded out,
         determine where the next record in the array is. */
       record = next_array_record (dtp, dtp->u.p.current_unit->ls,