re PR libfortran/16805 (Runtime failure using list directed read from string)
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 <bdavis9659@comcast.net> * gfortran.dg/list_read_2.f90: New test. From-SVN: r86844
This commit is contained in:
parent
af28769744
commit
334ff453ea
5 changed files with 47 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-08-31 Bud Davis <bdavis9659@comcast.net>
|
||||
|
||||
PR libfortran/16805
|
||||
* gfortran.dg/list_read_2.f90: New test.
|
||||
|
||||
2004-08-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* g++.dg/abi/key1.C: New test.
|
||||
|
|
25
gcc/testsuite/gfortran.dg/list_read_2.f90
Normal file
25
gcc/testsuite/gfortran.dg/list_read_2.f90
Normal file
|
@ -0,0 +1,25 @@
|
|||
! { dg-do run }
|
||||
! PR16805
|
||||
! Test list directed reads from character substrings
|
||||
! The IO library was reporting an error rather the end-or-fecord when it
|
||||
! got to the end of an internal file record.
|
||||
program list_read_2
|
||||
implicit none
|
||||
character*10 a
|
||||
data a /'1234567890'/
|
||||
integer i
|
||||
logical debug
|
||||
data debug /.TRUE./
|
||||
read(a,*)i
|
||||
if (i.ne.1234567890) call abort
|
||||
read(a(1:1),*)i
|
||||
if (i.ne.1) call abort
|
||||
read(a(2:2),*)i
|
||||
if (i.ne.2) call abort
|
||||
read(a(1:5),*)i
|
||||
if (i.ne.12345) call abort
|
||||
read(a(5:10),*)i
|
||||
if (i.ne.567890) call abort
|
||||
read(a(10:10),*)i
|
||||
if (i.ne.0) call abort
|
||||
end
|
|
@ -1,3 +1,9 @@
|
|||
2004-08-31 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
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 <tobias.schlueter@physik.uni-muenchen.de>
|
||||
|
||||
* io/unit.c: Separate copyright years by ','.
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue