-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>
--- /dev/null
+! { 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
+
--- /dev/null
+! { 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
+
+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
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;
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);
}