[multiple changes]
2005-07-13 Paul Thomas <pault@gcc.gnu.org> * io/read.c (read_complex): Prevent X formatting during reads from going beyond EOR to fix NIST fm908.FOR failure. * io/list_read.c (read_complex): Allow complex data in list- directed reads to have eols either side of the comma to fix NIST FM906.FOR failure. 2005-07-13 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/past_eor.f90: New. * gfortran.dg/complex_read.f90: New. From-SVN: r101984
This commit is contained in:
parent
ecd485052f
commit
b125b4cf0f
6 changed files with 111 additions and 7 deletions
|
@ -1,9 +1,7 @@
|
|||
2005-07-13 Jeff Law <law@redhat.com>
|
||||
2005-07-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
* gcc.dg/tree-ssa/pr22051-2.c: Tweak expected output to allow
|
||||
additional casts.
|
||||
|
||||
* gcc.dg/tree-ssa/pr22321.c: New test
|
||||
* gfortran.dg/past_eor.f90: New.
|
||||
* gfortran.dg/complex_read.f90: New.
|
||||
|
||||
2005-07-13 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
|
|
58
gcc/testsuite/gfortran.dg/complex_read.f90
Normal file
58
gcc/testsuite/gfortran.dg/complex_read.f90
Normal file
|
@ -0,0 +1,58 @@
|
|||
! { dg-do run }
|
||||
! Test of the fix to the bug in NIST fm906.for.
|
||||
! Contributed by Paul Thomas <pault@gcc.gnu.org>
|
||||
!
|
||||
program complex_read
|
||||
complex :: a
|
||||
open (10, status="scratch")
|
||||
|
||||
! Test that we have not broken the one line form.
|
||||
|
||||
write (10, *) " ( 0.99 , 9.9 )"
|
||||
rewind (10)
|
||||
read (10,*) a
|
||||
if (a.ne.(0.99, 9.90)) call abort ()
|
||||
|
||||
! Test a new record after the.comma (the original bug).
|
||||
|
||||
rewind (10)
|
||||
write (10, *) " ( 99.0 ,"
|
||||
write (10, *) " 999.0 )"
|
||||
rewind (10)
|
||||
read (10,*) a
|
||||
if (a.ne.(99.0, 999.0)) call abort ()
|
||||
|
||||
! Test a new record before the.comma
|
||||
|
||||
rewind (10)
|
||||
write (10, *) " ( 0.99 "
|
||||
write (10, *) " , 9.9 )"
|
||||
rewind (10)
|
||||
read (10,*) a
|
||||
if (a.ne.(0.99, 9.90)) call abort ()
|
||||
|
||||
! Test a new records before and after the.comma
|
||||
|
||||
rewind (10)
|
||||
write (10, *) " ( 99.0 "
|
||||
write (10, *) ", "
|
||||
write (10, *) " 999.0 )"
|
||||
rewind (10)
|
||||
read (10,*) a
|
||||
if (a.ne.(99.0, 999.0)) call abort ()
|
||||
|
||||
! Test a new records and blank records before and after the.comma
|
||||
|
||||
rewind (10)
|
||||
write (10, *) " ( 0.99 "
|
||||
write (10, *) " "
|
||||
write (10, *) ", "
|
||||
write (10, *) " "
|
||||
write (10, *) " 9.9 )"
|
||||
rewind (10)
|
||||
read (10,*) a
|
||||
if (a.ne.(0.99, 9.9)) call abort ()
|
||||
|
||||
close (10)
|
||||
end program complex_read
|
||||
|
22
gcc/testsuite/gfortran.dg/past_eor.f90
Normal file
22
gcc/testsuite/gfortran.dg/past_eor.f90
Normal file
|
@ -0,0 +1,22 @@
|
|||
! { dg-do run }
|
||||
! Test of the fix to the bug triggered by NIST fm908.for.
|
||||
! Contributed by Paul Thomas <pault@gcc.gnu.org>
|
||||
!
|
||||
program past_eor
|
||||
character(len=82) :: buffer
|
||||
real :: a(2), b(2), c(2), d(2), e(2)
|
||||
|
||||
e = (/2.34,2.456/)
|
||||
|
||||
! tests 28-31 from fm908.for
|
||||
|
||||
buffer = ' 2.34 , 2.456 2.34 , 2.456 0.234E01, 2.456E00&
|
||||
& 0.234E+001, 2.456E-000'
|
||||
|
||||
READ (UNIT=buffer,FMT=10) a, b, c, d
|
||||
10 FORMAT (2(2(G7.5,1X),2X),2(G10.4E2,1X),1X,2(G11.7E4,1X))
|
||||
|
||||
if (any (a.ne.e).or.any (b.ne.e).or.any (c.ne.e).or.any (d.ne.e)) call abort ()
|
||||
|
||||
end program past_eor
|
||||
|
|
@ -1,3 +1,11 @@
|
|||
2005-07-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
* io/read.c (read_complex): Prevent X formatting during reads
|
||||
from going beyond EOR to fix NIST fm908.FOR failure.
|
||||
* io/list_read.c (read_complex): Allow complex data in list-
|
||||
directed reads to have eols either side of the comma to
|
||||
fix NIST FM906.FOR failure.
|
||||
|
||||
2005-07-12 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR libfortran/21593
|
||||
|
|
|
@ -984,11 +984,25 @@ read_complex (int length)
|
|||
if (parse_real (value, length))
|
||||
return;
|
||||
|
||||
eol_1:
|
||||
eat_spaces ();
|
||||
c = next_char ();
|
||||
if (c == '\n' || c== '\r')
|
||||
goto eol_1;
|
||||
else
|
||||
unget_char (c);
|
||||
|
||||
if (next_char () != ',')
|
||||
goto bad_complex;
|
||||
|
||||
eol_2:
|
||||
eat_spaces ();
|
||||
c = next_char ();
|
||||
if (c == '\n' || c== '\r')
|
||||
goto eol_2;
|
||||
else
|
||||
unget_char (c);
|
||||
|
||||
if (parse_real (value + length, length))
|
||||
return;
|
||||
|
||||
|
|
|
@ -784,8 +784,12 @@ read_f (fnode * f, char *dest, int length)
|
|||
void
|
||||
read_x (fnode * f)
|
||||
{
|
||||
int n;
|
||||
int n, m;
|
||||
|
||||
n = f->u.n;
|
||||
read_block (&n);
|
||||
m = (int)current_unit->bytes_left;
|
||||
if (f->format == FMT_X)
|
||||
n = (n > m) ? m : n;
|
||||
if (n)
|
||||
read_block (&n);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue