diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-25 13:36:19 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-25 13:36:19 +0000 |
commit | e0f97db9eb84d304602eb35815ba9d188cd69e46 (patch) | |
tree | 84bddb2ec09b31241a95c5b1ded74d60cdff6239 /libgfortran/io | |
parent | f80df6b2af919960ad08a6f1901ddebb654f981b (diff) | |
download | gcc-e0f97db9eb84d304602eb35815ba9d188cd69e46.tar.gz |
2008-03-24 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r133512
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@133515 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/transfer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index c3e91149a27..5ccc95823a8 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1985,12 +1985,12 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) if (dtp->u.p.mode == READING && dtp->u.p.current_unit->mode == WRITING && !is_internal_unit (dtp)) - flush(dtp->u.p.current_unit->s); + flush(dtp->u.p.current_unit->s); /* Check whether the record exists to be read. Only a partial record needs to exist. */ - if (dtp->u.p.mode == READING && (dtp->rec -1) + if (dtp->u.p.mode == READING && (dtp->rec - 1) * dtp->u.p.current_unit->recl >= file_length (dtp->u.p.current_unit->s)) { generate_error (&dtp->common, LIBERROR_BAD_OPTION, @@ -2604,7 +2604,9 @@ next_record_w (st_parameter_dt *dtp, int done) if (is_stream_io (dtp)) { dtp->u.p.current_unit->strm_pos += len; - struncate(dtp->u.p.current_unit->s); + if (dtp->u.p.current_unit->strm_pos + < file_length (dtp->u.p.current_unit->s)) + struncate (dtp->u.p.current_unit->s); } } |