From 116a2a74817eca84dfc64bcf21cbc4bb020d8b66 Mon Sep 17 00:00:00 2001 From: pbrook Date: Tue, 31 Aug 2004 20:37:43 +0000 Subject: PR libfortran/16805 * io/list_read.c (next_char): Don't signal EOF for internal files. * io/unix.c (mem_alloc_r_at): Don't return NULL for incomplete reads. testsuite/ 2004-08-31 Bud Davis * gfortran.dg/list_read_2.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86844 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/list_read.c | 13 +++++++++++-- libgfortran/io/unix.c | 3 --- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'libgfortran') diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 83e03388269..50ad7a6290f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2004-08-31 Paul Brook + + PR libfortran/16805 + * io/list_read.c (next_char): Don't signal EOF for internal files. + * io/unix.c (mem_alloc_r_at): Don't return NULL for incomplete reads. + 2004-08-31 Tobias Schlueter * io/unit.c: Separate copyright years by ','. diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 8b00a5e296e..f47d473df91 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -142,8 +142,17 @@ next_char (void) } if (length == 0) - longjmp (g.eof_jump, 1); - c = *p; + { + /* For internal files return a newline instead of signalling EOF. */ + /* ??? This isn't quite right, but we don't handle internal files + with multiple records. */ + if (is_internal_unit ()) + c = '\n'; + else + longjmp (g.eof_jump, 1); + } + else + c = *p; done: at_eol = (c == '\n'); diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 33d7fda4514..377cadd438e 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -746,9 +746,6 @@ mem_alloc_r_at (unix_stream * s, int *len, gfc_offset where) if (where < s->buffer_offset || where > s->buffer_offset + s->active) return NULL; - if (is_internal_unit() && where + *len > s->file_length) - return NULL; - s->logical_offset = where + *len; n = s->buffer_offset + s->active - where; -- cgit v1.2.1