This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, libgfortran] [4.4/4.5 Regression] Endless loop in internal write
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 29 Jun 2009 17:40:34 -0700
- Subject: [Patch, libgfortran] [4.4/4.5 Regression] Endless loop in internal write
The following simple patch fixes this regression and passes regression testing.
I plan to commit as simple and obvious to 4.5 and 4.4. Regression tested on
x96-64-linux-gnu.
Thanks for the report.
Regards,
Jerry
2009-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/40576
* io/transfer.c (sset): Adjust exit condition for loop.
Index: io/transfer.c
===================================================================
--- io/transfer.c (revision 149073)
+++ io/transfer.c (working copy)
@@ -2867,7 +2867,7 @@ sset (stream * s, int c, ssize_t nbyte)
{
trans = (bytes_left < WRITE_CHUNK) ? bytes_left : WRITE_CHUNK;
trans = swrite (s, p, trans);
- if (trans < 0)
+ if (trans <= 0)
return trans;
bytes_left -= trans;
}