PR 49296 List read, EOF without preceding separator
2011-07-13 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-13 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/49296 * gfortran.dg/read_list_eof_1.f90: Add tests for integer, real, and logical reads. From-SVN: r176245
This commit is contained in:
parent
9e34e53f8e
commit
5f54710465
4 changed files with 54 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2011-07-13 Janne Blomqvist <jb@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR libfortran/49296
|
||||||
|
* gfortran.dg/read_list_eof_1.f90: Add tests for integer, real,
|
||||||
|
and logical reads.
|
||||||
|
|
||||||
2011-07-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
2011-07-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* gcc.c-torture/execute/990127-2.x: Use -mpc64 on i?86-*-darwin*,
|
* gcc.c-torture/execute/990127-2.x: Use -mpc64 on i?86-*-darwin*,
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
program read_list_eof_1
|
program read_list_eof_1
|
||||||
implicit none
|
implicit none
|
||||||
character(len=100) :: s
|
character(len=100) :: s
|
||||||
call genfil ()
|
integer :: ii
|
||||||
|
real :: rr
|
||||||
|
logical :: ll
|
||||||
|
|
||||||
|
call genfil ('a')
|
||||||
open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
|
open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
|
||||||
status='OLD')
|
status='OLD')
|
||||||
read (20, fmt=*) s
|
read (20, fmt=*) s
|
||||||
|
@ -12,11 +16,39 @@ program read_list_eof_1
|
||||||
call abort ()
|
call abort ()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
call genfil ('1')
|
||||||
|
open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
|
||||||
|
status='OLD')
|
||||||
|
read (20, fmt=*) ii
|
||||||
|
close (20, status='delete')
|
||||||
|
if (ii /= 1) then
|
||||||
|
call abort ()
|
||||||
|
end if
|
||||||
|
|
||||||
|
call genfil ('1.5')
|
||||||
|
open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
|
||||||
|
status='OLD')
|
||||||
|
read (20, fmt=*) rr
|
||||||
|
close (20, status='delete')
|
||||||
|
if (rr /= 1.5) then
|
||||||
|
call abort ()
|
||||||
|
end if
|
||||||
|
|
||||||
|
call genfil ('T')
|
||||||
|
open (unit=20, file='read.dat', form='FORMATTED', action='READ', &
|
||||||
|
status='OLD')
|
||||||
|
read (20, fmt=*) ll
|
||||||
|
close (20, status='delete')
|
||||||
|
if (.not. ll) then
|
||||||
|
call abort ()
|
||||||
|
end if
|
||||||
|
|
||||||
contains
|
contains
|
||||||
subroutine genfil
|
subroutine genfil(str)
|
||||||
|
character(len=*), intent(in) :: str
|
||||||
open(10, file='read.dat', form='unformatted', action='write', &
|
open(10, file='read.dat', form='unformatted', action='write', &
|
||||||
status='replace', access='stream')
|
status='replace', access='stream')
|
||||||
write(10) 'a'
|
write(10) str
|
||||||
close(10)
|
close(10)
|
||||||
end subroutine genfil
|
end subroutine genfil
|
||||||
end program read_list_eof_1
|
end program read_list_eof_1
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2011-07-13 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.
|
||||||
|
|
||||||
2011-07-09 Tobias Burnus <burnus@net-b.de>
|
2011-07-09 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
* runtime/error.c (sys_abort): Change argument list
|
* runtime/error.c (sys_abort): Change argument list
|
||||||
|
|
|
@ -657,22 +657,20 @@ read_logical (st_parameter_dt *dtp, int length)
|
||||||
{
|
{
|
||||||
case 't':
|
case 't':
|
||||||
v = 1;
|
v = 1;
|
||||||
if ((c = next_char (dtp)) == EOF)
|
c = next_char (dtp);
|
||||||
goto bad_logical;
|
|
||||||
l_push_char (dtp, c);
|
l_push_char (dtp, c);
|
||||||
|
|
||||||
if (!is_separator(c))
|
if (!is_separator(c) && c != EOF)
|
||||||
goto possible_name;
|
goto possible_name;
|
||||||
|
|
||||||
unget_char (dtp, c);
|
unget_char (dtp, c);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
v = 0;
|
v = 0;
|
||||||
if ((c = next_char (dtp)) == EOF)
|
c = next_char (dtp);
|
||||||
goto bad_logical;
|
|
||||||
l_push_char (dtp, c);
|
l_push_char (dtp, c);
|
||||||
|
|
||||||
if (!is_separator(c))
|
if (!is_separator(c) && c != EOF)
|
||||||
goto possible_name;
|
goto possible_name;
|
||||||
|
|
||||||
unget_char (dtp, c);
|
unget_char (dtp, c);
|
||||||
|
@ -837,6 +835,7 @@ read_integer (st_parameter_dt *dtp, int length)
|
||||||
goto repeat;
|
goto repeat;
|
||||||
|
|
||||||
CASE_SEPARATORS: /* Not a repeat count. */
|
CASE_SEPARATORS: /* Not a repeat count. */
|
||||||
|
case EOF:
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -886,6 +885,7 @@ read_integer (st_parameter_dt *dtp, int length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CASE_SEPARATORS:
|
CASE_SEPARATORS:
|
||||||
|
case EOF:
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue