aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2006-11-25 07:12:56 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2006-11-25 07:12:56 +0000
commit328d8f5c8bab53320060fc9ef4a2d8328d2849fc (patch)
tree66a4b4a44fd240bfdc784fec9e7358c56dcf1ad1 /libgfortran
parent10820765550ae8e6e00a8a04eb12092e1ef7ac15 (diff)
re PR libfortran/29936 (Missed constraint on RECL=specifier in unformatted sequential WRITE)
2006-11-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/29936 * 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: r119184
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/io/io.h1
-rw-r--r--libgfortran/io/open.c6
-rw-r--r--libgfortran/io/transfer.c9
4 files changed, 19 insertions, 5 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index ad551d309e6..db30a6999d2 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/29936
+ * 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-13 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/27895
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 24ce51a7064..571a59c8b50 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 c5c2e1655e9..a1b4558ccd8 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1449,10 +1449,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;
}