re PR fortran/52251 (Nonadvancing I/O and the t edit descriptor)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 23 Nov 2015 00:40:51 +0000 (00:40 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 23 Nov 2015 00:40:51 +0000 (00:40 +0000)
2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/52251
* io/transfer.c (formatted_transfer_scalar_write): Reset skips count.
(finalize_transfer): For ADVANCE_NO, emit pending spaces and reset the
skip count.

2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

* gfortran.dg/fmt_t_8.f90: New test.

From-SVN: r230734

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/fmt_t_8.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/transfer.c

index 3074642b247582102af1468359a51d154f1943f3..5c670114c74d5facdec2f4b250d824128611e71a 100644 (file)
@@ -1,3 +1,7 @@
+2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       * gfortran.dg/fmt_t_8.f90: New test.
+
 2015-11-23  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        PR target/68390
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_8.f90 b/gcc/testsuite/gfortran.dg/fmt_t_8.f90
new file mode 100644 (file)
index 0000000..d56d19b
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do run }
+! PR52251 Tabs with advance = 'no'
+write( *, '( t25 )', advance = 'no' )
+write( *, '( "hello" )' ) ! { dg-output "                       hello(\n|\r\n|\r)" }
+end
+
index f90d5301df85a2a5a6960a84e390fa10db03515e..48db71b8df7d010687d040486c05fc039c16f0de 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/52251
+       * io/transfer.c (formatted_transfer_scalar_write): Reset skips count.
+       (finalize_transfer): For ADVANCE_NO, emit pending spaces and reset the
+       skip count.
+
 2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        * io/write_float.def (output_float): Move block determining
index 746bb6dcc6cc4f3aa64f6410808383835b344322..94f1edaa67970b926632ec2ba7eb1cf57b829a42 100644 (file)
@@ -1641,6 +1641,7 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin
                          - dtp->u.p.current_unit->bytes_left);
              dtp->u.p.max_pos = 
                dtp->u.p.max_pos > tmp ? dtp->u.p.max_pos : tmp;
+             dtp->u.p.skips = 0;
            }
          if (dtp->u.p.skips < 0)
            {
@@ -3600,6 +3601,16 @@ finalize_transfer (st_parameter_dt *dtp)
      next I/O operation if needed.  */
   if (dtp->u.p.advance_status == ADVANCE_NO)
     {
+      if (dtp->u.p.skips > 0)
+       {
+         int tmp;
+         write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
+         tmp = (int)(dtp->u.p.current_unit->recl
+                     - dtp->u.p.current_unit->bytes_left);
+         dtp->u.p.max_pos = 
+           dtp->u.p.max_pos > tmp ? dtp->u.p.max_pos : tmp;
+         dtp->u.p.skips = 0;
+       }
       int bytes_written = (int) (dtp->u.p.current_unit->recl
        - dtp->u.p.current_unit->bytes_left);
       dtp->u.p.current_unit->saved_pos =