From 8d917a24a765d8a0eff7a44e73e2104851feb8df Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 9 Jul 2007 00:15:15 +0000 Subject: [PATCH] re PR fortran/32678 ([4.2, 4.1]GFortan works incorrectly when writing with FORMAT Tx) 2007-07-08 Jerry DeLisle PR libgfortran/32678 * io/transfer.c (formatted_transfer_scalar): Don't allow pending_spaces to go negative. From-SVN: r126473 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/transfer.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 0b9239d1e0a..7b6f3e567cd 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2007-07-08 Jerry DeLisle + + PR libgfortran/32678 + * io/transfer.c (formatted_transfer_scalar): Don't allow pending_spaces + to go negative. + 2007-07-08 Thomas Koenig PR libfortran/32217 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 6e3ae30b140..a1c774e1dfd 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1213,6 +1213,8 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, dtp->u.p.skips = dtp->u.p.skips + pos - bytes_used; dtp->u.p.pending_spaces = dtp->u.p.pending_spaces + pos - dtp->u.p.max_pos; + dtp->u.p.pending_spaces = dtp->u.p.pending_spaces < 0 + ? 0 : dtp->u.p.pending_spaces; if (dtp->u.p.skips == 0) break;