re PR fortran/33400 (Formatted read fails if line ends without line break)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 30 Sep 2007 14:36:40 +0000 (14:36 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 30 Sep 2007 14:36:40 +0000 (14:36 +0000)
2007-09-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/33400
* gfortran.dg/PR19872.f: Fix test condition.
* gfortran.dg/list_read_7.f90: New test.

From-SVN: r128892

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/PR19872.f
gcc/testsuite/gfortran.dg/list_read_7.f90 [new file with mode: 0644]

index ef5e04a5afbd5e102fb03692d5a2364d5e436b72..45a3afbe9de6b0d4b36a5137a1fb8a5e2a22d382 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/33400
+       * gfortran.dg/PR19872.f: Fix test condition.
+       * gfortran.dg/list_read_7.f90: New test.
+
 2007-09-30  Uros Bizjak  <ubizjak@gmail.com>
 
        PR tree-optimization/33597
index dda9a8bdf9d4ca6ef03d1fef21cf66707b86b95b..12bba3352a2e7c5cbccea19a3c2c062e9f36bef9 100644 (file)
       close(1)
       open(1,form='FORMATTED')
       read(1,*)i
-      if(i(1).ne.9.and.i(2).ne.8.and.i(3).ne.7.and.i(4).ne.9)call abort
-      read(1,*,end=200)i
+      if(i(1).ne.9.or.i(2).ne.8.or.i(3).ne.7.or.i(4).ne.6)call abort
+      read(1,*, end=200)i
 ! should only be able to read one line from the file
       call abort
  200  continue
-      close(1,STATUS='DELETE')
+      close(1,STATUS='delete')
       end
diff --git a/gcc/testsuite/gfortran.dg/list_read_7.f90 b/gcc/testsuite/gfortran.dg/list_read_7.f90
new file mode 100644 (file)
index 0000000..5db8995
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do run }
+! PR33400 Formatted read fails if line ends without line break
+! Test case modified from that in PR by <jvdelisle@gcc.gnu.org>
+integer, parameter :: fgsl_strmax = 128
+character(len=fgsl_strmax) :: ieee_str1, ieee_str2
+open(unit=20, file='test.dat',form='FORMATTED')
+write(20,'(a)',advance="no") ' 1.01010101010101010101010101010101&
+       &01010101010101010101*2^-2 1.01010101010101010101011*2^-2'
+rewind(20)
+read(20, fmt=*) ieee_str1, ieee_str2
+if (trim(ieee_str1) /= &
+    '1.0101010101010101010101010101010101010101010101010101*2^-2') &
+  call abort
+if (trim(ieee_str2) /= &
+     '1.01010101010101010101011*2^-2') &
+  call abort
+end