]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
io.h (unit_flags): Add new flag has_recl.
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 22 Nov 2006 07:32:09 +0000 (07:32 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 22 Nov 2006 07:32:09 +0000 (07:32 +0000)
2006-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

* io/io.h (unit_flags): Add new flag has_recl.
* io.open.c (new_unit): Set flag if RECL= was specified.
* io/transfer.c (us_write): If flag set, leave recl as initialized by
new_unit.

From-SVN: r119087

libgfortran/ChangeLog
libgfortran/io/io.h
libgfortran/io/open.c
libgfortran/io/transfer.c

index c62e6081450639c7741a68e60abbbd22c35a0b77..553cd1a93a1b389827b03262a49ddb9a84b74c01 100644 (file)
@@ -1,3 +1,10 @@
+2006-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       * io/io.h (unit_flags): Add new flag has_recl.
+       * io.open.c (new_unit): Set flag if RECL= was specified.
+       * io/transfer.c (us_write): If flag set, leave recl as initialized by
+       new_unit.
+
 2006-11-16  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        * io/open.c (new_unit): Format %d expects an int variable.
index e009f17e3c47e397265ff686c359352beddeccb1..e8e8390d1c54bf732c9f167bf93c7744a1ac1fc5 100644 (file)
@@ -470,6 +470,7 @@ typedef struct
   unit_status status;
   unit_pad pad;
   unit_convert convert;
+  int has_recl;
 }
 unit_flags;
 
index ce7d4dd2cbfd6a867c57240914105950c7c5a924..9b4f0cd7122d440dfae0482febec754def8b2447 100644 (file)
@@ -406,9 +406,13 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags)
   /* Unspecified recl ends up with a processor dependent value.  */
 
   if ((opp->common.flags & IOPARM_OPEN_HAS_RECL_IN))
-    u->recl = opp->recl_in;
+    {
+      u->flags.has_recl = 1;
+      u->recl = opp->recl_in;
+    }
   else
     {
+      u->flags.has_recl = 0;
       switch (compile_options.record_marker)
        {
        case 0:
index c8fd5571e5ff1d93bd0007bf1563341bd7cb3972..329d49828d4ea9a65330a72629870a519ce77a89 100644 (file)
@@ -1459,10 +1459,11 @@ us_write (st_parameter_dt *dtp)
   if (swrite (dtp->u.p.current_unit->s, &dummy, &nbytes) != 0)
     generate_error (&dtp->common, ERROR_OS, NULL);
 
-  /* For sequential unformatted, we write until we have more bytes
-     than can fit in the record markers. If disk space runs out first,
-     it will error on the write.  */
-  dtp->u.p.current_unit->recl = max_offset;
+  /* For sequential unformatted, if RECL= was not specified in the OPEN
+     we write until we have more bytes than can fit in the record markers.
+     If disk space runs out first, it will error on the write.  */
+  if (dtp->u.p.current_unit->flags.has_recl == 0)
+    dtp->u.p.current_unit->recl = max_offset;
 
   dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
 }