Patchwork [libgfortran] PR55818 Reading a REAL from a file which doesn't end in a new line fails

login
register
mail settings
Submitter jerry DeLisle
Date Dec. 28, 2012, 1:59 a.m.
Message ID <50DCFCF4.4030500@charter.net>
Download mbox | patch
Permalink /patch/208361/
State New
Headers show

Comments

jerry DeLisle - Dec. 28, 2012, 1:59 a.m.
Hi,

The attached patch fixes this problem by not calling hit_eof if EOF can be a
valid separator.

Regression tested on x86-64.

OK for trunk with test case from PR?

Regards,

Jerry

2012-12-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/55818
	* io/list_read.c (read_real): Do not call hit_eof when EOF can be
	treated as a value separator

Patch

Index: list_read.c
===================================================================
--- list_read.c	(revision 194731)
+++ list_read.c	(working copy)
@@ -1429,6 +1429,7 @@  read_real (st_parameter_dt *dtp, void * dest, int
       goto got_sign;
 
     CASE_SEPARATORS:
+    case EOF:
       unget_char (dtp, c);		/* Single null.  */
       eat_separator (dtp);
       return;
@@ -1484,6 +1485,7 @@  read_real (st_parameter_dt *dtp, void * dest, int
 	  goto got_repeat;
 
 	CASE_SEPARATORS:
+	case EOF:
           if (c != '\n' && c != ',' && c != '\r' && c != ';')
 	    unget_char (dtp, c);
 	  goto done;