diff mbox

[libfortran] PR 49296 List read of file without EOR

Message ID CAO9iq9HxGBkH4v=viKn=3Eojkginsd8XgvAkP_NUXPzedb+OyQ@mail.gmail.com
State New
Headers show

Commit Message

Janne Blomqvist July 3, 2011, 9:57 p.m. UTC
Hi,

the attached patch fixes the remaining cases of handling input that
ends in EOF instead of a normal separator for list formatted read of
the primitive types. Ok for trunk and 4.6?

2011-07-04  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/49296
	* io/list_read.c (read_logical): Don't error out if a valid value
	is followed by EOF instead of a normal separator.
	(read_integer): Likewise.

testsuite:

2011-07-04  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/49296
	* gfortran.dg/read_list_eof_1.f90: Add tests for integer, real,
	and logical reads.

Comments

Janne Blomqvist July 12, 2011, 8:05 a.m. UTC | #1
PING

On Mon, Jul 4, 2011 at 00:57, Janne Blomqvist <blomqvist.janne@gmail.com> wrote:
> Hi,
>
> the attached patch fixes the remaining cases of handling input that
> ends in EOF instead of a normal separator for list formatted read of
> the primitive types. Ok for trunk and 4.6?
>
> 2011-07-04  Janne Blomqvist  <jb@gcc.gnu.org>
>
>        PR libfortran/49296
>        * io/list_read.c (read_logical): Don't error out if a valid value
>        is followed by EOF instead of a normal separator.
>        (read_integer): Likewise.
>
> testsuite:
>
> 2011-07-04  Janne Blomqvist  <jb@gcc.gnu.org>
>
>        PR libfortran/49296
>        * gfortran.dg/read_list_eof_1.f90: Add tests for integer, real,
>        and logical reads.
>
>
> --
> Janne Blomqvist
>
Jerry DeLisle July 12, 2011, 12:25 p.m. UTC | #2
On 07/12/2011 01:05 AM, Janne Blomqvist wrote:
> PING
>
> On Mon, Jul 4, 2011 at 00:57, Janne Blomqvist<blomqvist.janne@gmail.com>  wrote:
>> Hi,
>>
>> the attached patch fixes the remaining cases of handling input that
>> ends in EOF instead of a normal separator for list formatted read of
>> the primitive types. Ok for trunk and 4.6?
>>

Yes, OK.  I have been on vacation and missed this sooner.

Thanks for patch.

Jerry
diff mbox

Patch

diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index baf2f54..c88f232 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -657,22 +657,20 @@  read_logical (st_parameter_dt *dtp, int length)
     {
     case 't':
       v = 1;
-      if ((c = next_char (dtp)) == EOF)
-	goto bad_logical;
+      c = next_char (dtp);
       l_push_char (dtp, c);
 
-      if (!is_separator(c))
+      if (!is_separator(c) && c != EOF)
 	goto possible_name;
 
       unget_char (dtp, c);
       break;
     case 'f':
       v = 0;
-      if ((c = next_char (dtp)) == EOF)
-	goto bad_logical;
+      c = next_char (dtp);
       l_push_char (dtp, c);
 
-      if (!is_separator(c))
+      if (!is_separator(c) && c != EOF)
 	goto possible_name;
 
       unget_char (dtp, c);
@@ -837,6 +835,7 @@  read_integer (st_parameter_dt *dtp, int length)
 	  goto repeat;
 
 	CASE_SEPARATORS:	/* Not a repeat count.  */
+	case EOF:
 	  goto done;
 
 	default:
@@ -886,6 +885,7 @@  read_integer (st_parameter_dt *dtp, int length)
 	  break;
 
 	CASE_SEPARATORS:
+	case EOF:
 	  goto done;
 
 	default: