summaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-22 07:32:09 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-22 07:32:09 +0000
commitf88c47bea82f0ece38a76a3fb236d3e49080c9dc (patch)
treea44192f26db743063df6208c3b6faf5ddfa0bb62 /libgfortran/io
parent3ba26e4d6853b4bd4675b1b8add56a221f7550fb (diff)
downloadgcc-f88c47bea82f0ece38a76a3fb236d3e49080c9dc.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119087 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/io.h1
-rw-r--r--libgfortran/io/open.c6
-rw-r--r--libgfortran/io/transfer.c9
3 files changed, 11 insertions, 5 deletions
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index e009f17e3c4..e8e8390d1c5 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -470,6 +470,7 @@ typedef struct
unit_status status;
unit_pad pad;
unit_convert convert;
+ int has_recl;
}
unit_flags;
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index ce7d4dd2cbf..9b4f0cd7122 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -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:
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index c8fd5571e5f..329d49828d4 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -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;
}