read.c (read_x): Take int argument instead of fnode * and digging the N from F->u.n.
authorJakub Jelinek <jakub@redhat.com>
Sat, 3 Sep 2005 18:54:55 +0000 (20:54 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 3 Sep 2005 18:54:55 +0000 (20:54 +0200)
* io/read.c (read_x): Take int argument instead of fnode * and
digging the N from F->u.n.
* io/io.h (read_x): Adjust prototype.
* io/transfer.c (formatted_transfer): Adjust callers.  Don't clobber
f->u.n for FMT_T.

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

From-SVN: r103811

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

index 496ecc3c2ce3ce397392d1a573b36fca273c7837..17b5b03c7e659aaa939e4ffc656fefd9cee36a34 100644 (file)
@@ -1,3 +1,7 @@
+2005-09-03  Jakub Jelinek  <jakub@redhat.com>
+
+       * gfortran.dg/fmt_t_1.f90: New test.
+
 2005-09-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/23454
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_1.f90 b/gcc/testsuite/gfortran.dg/fmt_t_1.f90
new file mode 100644 (file)
index 0000000..157ba13
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do run }
+      integer nrow, vec(15)
+      open (10, status="scratch")
+      write (10, fmt='(a)') '001    1 2 3 4 5 6'
+      write (10, fmt='(a)') '000000 7 8 9101112'
+      write (10, fmt='(a)') '000000131415'
+      rewind (10)
+      read (10, fmt='(i6, (t7, 6i2))') nrow, (vec(i), i=1,15)
+      close (10)
+      if (nrow.ne.1) call abort
+      if (any (vec.ne.(/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15/))) call abort
+      end
index a2dba91b4db46dd36c7e5b6b52ed4e6e58d29677..02df5fd0858fb4a1d13a12c332ec1c23e7509efb 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-03  Jakub Jelinek  <jakub@redhat.com>
+
+       * io/read.c (read_x): Take int argument instead of fnode * and
+       digging the N from F->u.n.
+       * io/io.h (read_x): Adjust prototype.
+       * io/transfer.c (formatted_transfer): Adjust callers.  Don't clobber
+       f->u.n for FMT_T.
+
 2005-09-02  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        * io/unix.c (stream_ttyname): Protect use of ttyname by
index 83f2dfbd0d49741b69965b0d2a54a61eab004ea5..06825df8c297e14155598d2e7cf690fdfe37d57c 100644 (file)
@@ -589,7 +589,7 @@ internal_proto(read_f);
 extern void read_l (fnode *, char *, int);
 internal_proto(read_l);
 
-extern void read_x (fnode *);
+extern void read_x (int);
 internal_proto(read_x);
 
 extern void read_radix (fnode *, char *, int, int);
index 64231b936c26c80a9aea1c0baadd52d48093b597..ec6077ca45e6dd3f7c9b5aaf9a63eb78c13c2ade 100644 (file)
@@ -831,12 +831,8 @@ read_f (fnode * f, char *dest, int length)
  * and never look at it. */
 
 void
-read_x (fnode * f)
+read_x (int n)
 {
-  int n;
-
-  n = f->u.n;
-
   if ((current_unit->flags.pad == PAD_NO || is_internal_unit ())
       && current_unit->bytes_left < n)
     n = current_unit->bytes_left;
index c7d53ee7cd82af520f85fac329879c4fe7f3cfd5..7449f02d3dda8aabe08ff58f6d89d36cb805e34f 100644 (file)
@@ -705,7 +705,7 @@ formatted_transfer (bt type, void *p, int len)
          /* Writes occur just before the switch on f->format, above, so that
             trailing blanks are suppressed.  */
          if (g.mode == READING)
-           read_x (f);
+           read_x (f->u.n);
 
          break;
 
@@ -736,10 +736,7 @@ formatted_transfer (bt type, void *p, int len)
          if (g.mode == READING)
            {
              if (skips > 0)
-               {
-                 f->u.n = skips;
-                 read_x (f);
-               }
+               read_x (skips);
              if (skips < 0)
                {
                  move_pos_offset (current_unit->s, skips);