diff options
author | Bud Davis <bdavis@gcc.gnu.org> | 2005-02-23 04:09:17 +0000 |
---|---|---|
committer | Bud Davis <bdavis@gcc.gnu.org> | 2005-02-23 04:09:17 +0000 |
commit | 397763d2af80316f05484a8668c3d0dddf2c9811 (patch) | |
tree | de14bff1e5b45413cca3b8e5f95bd35c6730e5ba | |
parent | e59ba1bccdc8895dd90e52b332869cf8015bd829 (diff) | |
download | gcc-397763d2af80316f05484a8668c3d0dddf2c9811.zip gcc-397763d2af80316f05484a8668c3d0dddf2c9811.tar.gz gcc-397763d2af80316f05484a8668c3d0dddf2c9811.tar.bz2 |
[multiple changes]
2004-02-22 Paul Thomas <paulthomas2@wannado.fr>
Bud Davis <bdavis@gfortran.org>
* io/list_read.c (read_real): Handle separators properly
in list directed read.
2005-02-22 Bud Davis <bdavis@gfortran.org>
* gfortran.dg/list_read_4.f90: new test.
From-SVN: r95436
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/list_read_4.f90 | 54 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 6 |
4 files changed, 66 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91b54b0..ddaa9cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-02-22 Bud Davis <bdavis@gfortran.org> + + * gfortran.dg/list_read_4.f90: new test. + 2005-02-22 Kazu Hirata <kazu@cs.umass.edu> PR rtl-optimization/20017. diff --git a/gcc/testsuite/gfortran.dg/list_read_4.f90 b/gcc/testsuite/gfortran.dg/list_read_4.f90 new file mode 100644 index 0000000..8260ca2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/list_read_4.f90 @@ -0,0 +1,54 @@ +C { dg-do run } +C Test of gfortran list directed read> check delimiters are correctly +C treated. Written in f77 so that g77 will run for comparison. +C +C f , e and i edit reads are terminated separately by read_real.c +C +C PThomas Jan 2005 +C BDavis + program list_read_4 + integer i(10),l(10),k,j + real x(10),y(10) +C expected results + data y / 1.0,2.0,3.0,-1.0,-1.0,-1.0,4.0,4.0,99.0,99.0 / + data l /1,2,3,-1,-1,-1,4,4,99,99/ +C put them in a file + open (10,status="scratch") + write (10,*) " 1.0, 2.0 , 3.0,, 2* , 2*4.0 , 5*99.0" + write (10,*) " 1.0e0, 2.0e0 , 3.0e0,, 2* , 2*4.0e0 , 5*99.0e0" + write (10,*) " 1, 2 , 3,, 2* , 2*4 , 5*99" + write (10,*) " 1, 2 , 3,, 2* , 2*4 , 5*99" + rewind (10) +C + do k = 1,10 + x(k) = -1.0 + enddo + read (10,*,iostat=ier) x + if (ier.ne.0) call abort + do k = 1,10 + if (x(k).ne.y(k)) call abort + x(k) = -1 + end do + READ(10,*,iostat=ier) x + if (ier.ne.0) call abort + do k = 1,10 + if (x(k).ne.y(k)) call abort + x(k) = -1 + end do + READ(10,*,iostat=ier) x + if (ier.ne.0) call abort + do k = 1,10 + if (x(k).ne.y(k)) call abort + x(k) = -1 + end do +C integer + do k = 1,10 + i(k) = -1 + end do + READ(10,*,iostat=ier) (i(j),j=1,10) + if (ier.ne.0) call abort + do k = 1,10 + if (i(k).ne.y(k)) call abort + i(k) = -1 + end do + end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 39b835d..cdb0868 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2004-02-22 Paul Thomas <paulthomas2@wannado.fr> + Bud Davis <bdavis@gfortran.org> + + * io/list_read.c (read_real): Handle separators properly + in list directed read. + 2004-02-21 Bud Davis <bdavis@gfortran.org> PR fortran/20086 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index eecc114..74a6688 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1052,8 +1052,6 @@ read_real (int length) goto got_repeat; CASE_SEPARATORS: - if (c != '\n' && c != ',') - unget_char (c); /* Real number that is just a digit-string. */ goto done; default: @@ -1164,8 +1162,6 @@ read_real (int length) break; CASE_SEPARATORS: - unget_char (c); - eat_separator (); goto done; default: @@ -1174,6 +1170,8 @@ read_real (int length) } done: + unget_char (c); + eat_separator (); push_char ('\0'); if (convert_real (value, saved_string, length)) return; |