This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.5] reading formatted file where CR is missing in last line


Jerry DeLisle wrote:
JBF wrote:
Hi,

I have some formatted data files coming from old MS-Windows time in which the
last line does not have any end-of-line mark.
If I read thee files with gfortran 4.2 (ubuntu 8.04 installation) or g95 there
is no problem. If I read the files with gfortran 4.5 (4.5.0 20090917
(experimental) [trunk revision 151790]) the last line is not read because the
end-of-file mark is reached.


Is it a bug or a feature ?

I believe this is a bug. I tested with 4.3 and it does read the last line fine.

This is a regression and it is closely related to PR41328. I will note this in that PR, work up a patch, and add this test case to our test suite.

Thanks for the report. I should be able to fix this in the next day or so.

Regards,

Jerry

Committed as obvious on trunk, revision 151877. Will back port to 4.4.x soon.

Thanks again for the report. See PR41328 for commit logs.

2009-09-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR libgfortran/41328
	* io/transfer.c (read_sf): Set at_eof flag on short read if any
	characters were successfully read so that EOF condition with no EOR
	marker succeeds.

Index: transfer.c
===================================================================
--- transfer.c	(revision 151864)
+++ transfer.c	(working copy)
@@ -291,7 +301,7 @@
      some other stuff. Set the relevant flags.  */
   if (lorig > *length && !dtp->u.p.sf_seen_eor && !seen_comma)
     {
-      if (no_error)
+      if (n > 0 || no_error)
         dtp->u.p.at_eof = 1;
       else
         {




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]