diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-01-18 00:52:21 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-01-18 00:52:21 +0000 |
commit | 272c35bd98b4b9276aef1c53bceadc3535e6dc9c (patch) | |
tree | 741efbb1ab7753b43848a7aee7b4f4c7747af2a6 /libgfortran/io/transfer.c | |
parent | d190d56b7e7921a58656cded35fe4722c57c9bb8 (diff) | |
download | gcc-272c35bd98b4b9276aef1c53bceadc3535e6dc9c.zip gcc-272c35bd98b4b9276aef1c53bceadc3535e6dc9c.tar.gz gcc-272c35bd98b4b9276aef1c53bceadc3535e6dc9c.tar.bz2 |
re PR libfortran/25631 (tl format specifier not working correctly)
2006-01-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25631
* io/transfer.c (formatted_transfer_scalar): Adjust pending_spaces and
skips so that TL works correctly when no bytes_used yet.
From-SVN: r109858
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 049ebb2..7298835 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -868,7 +868,21 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, case FMT_TL: case FMT_T: if (f->format == FMT_TL) - pos = bytes_used - f->u.n; + { + + /* Handle the special case when no bytes have been used yet. + Cannot go below zero. */ + if (bytes_used == 0) + { + dtp->u.p.pending_spaces -= f->u.n; + dtp->u.p.pending_spaces = dtp->u.p.pending_spaces < 0 ? 0 + : dtp->u.p.pending_spaces; + dtp->u.p.skips -= f->u.n; + dtp->u.p.skips = dtp->u.p.skips < 0 ? 0 : dtp->u.p.skips; + } + + pos = bytes_used - f->u.n; + } else /* FMT_T */ { consume_data_flag = 0; |