From: Jerry DeLisle Date: Thu, 7 Oct 2010 02:31:14 +0000 (+0000) Subject: backport: re PR fortran/45710 (Adjust format and padding for WRITE of NAMELIST group... X-Git-Tag: releases/gcc-4.4.6~328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92e0f542f190e90f12a9e82bd8b8b659339e28e7;p=thirdparty%2Fgcc.git backport: re PR fortran/45710 (Adjust format and padding for WRITE of NAMELIST group to internal file) 2010-10-06 Jerry DeLisle Backport from mainline: PR libfortran/45710 * io/write.c (namelist_write_newline): Pad character array internal unit records with spaces. From-SVN: r165079 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index ef668b8c770e..031bc7ae5a3f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2010-10-06 Jerry DeLisle + + 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. diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index b6d6e687736d..730f08173c8c 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -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,