aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2006-01-18 00:52:21 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2006-01-18 00:52:21 +0000
commite60c5e769c9eab32bad2251af926965722ff2662 (patch)
tree741efbb1ab7753b43848a7aee7b4f4c7747af2a6 /libgfortran
parenta6741e15cceff03c6d33edaffb673036887b0c99 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@109858 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/transfer.c16
2 files changed, 21 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 5ce87028e72..d5e178ed9f3 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2006-01-16 Roger Sayle <roger@eyesopen.com>
* configure.ac (CFLAGS): Update to include -std=gnu99 so that
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 049ebb24771..729883586f8 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;