summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/read_eof_all.f90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/read_eof_all.f90
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/read_eof_all.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/read_eof_all.f9071
1 files changed, 71 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/read_eof_all.f90 b/gcc/testsuite/gfortran.dg/read_eof_all.f90
new file mode 100644
index 000000000..db6def487
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/read_eof_all.f90
@@ -0,0 +1,71 @@
+! { dg-do run }
+! PR43265 Followup patch for miscellaneous EOF conditions.
+! Eaxamples from Tobius Burnus
+ use iso_fortran_env
+ character(len=2) :: str, str2(2)
+ integer :: a, b, c, ios
+ str = ''
+ str2 = ''
+
+ open(99,file='test.dat',access='stream',form='unformatted', status='replace')
+ write(99) ' '
+ close(99)
+
+ open(99,file='test.dat')
+ read(99, '(T7,i2)') i
+ close(99, status="delete")
+ if (i /= 0) call abort
+
+ read(str(1:0), '(T7,i1)') i
+ if (i /= 0) call abort
+
+ read(str,'(i2,/,i2)',end=111) a, b
+ call abort !stop 'ERROR: Expected EOF error (1)'
+ 111 continue
+
+ read(str2,'(i2,/,i2)',end=112) a, b
+
+ read(str2,'(i2,/,i2,/,i2)',end=113) a, b, c
+ call abort !stop 'ERROR: Expected EOF error (2)'
+
+ 112 call abort !stop 'ERROR: Unexpected EOF (3)'
+
+ 113 continue
+ read(str,'(i2,/,i2)',end=121,pad='no') a, b
+ call abort !stop 'ERROR: Expected EOF error (1)'
+ 121 continue
+
+ read(str2(:),'(i2,/,i2)', end=122, pad='no') a, b
+ goto 125
+ 122 call abort !stop 'ERROR: Expected no EOF error (2)'
+ 125 continue
+
+ read(str2(:),'(i2,/,i2,/,i2)',end=123,pad='no') a, b, c
+ call abort !stop 'ERROR: Expected EOF error (3)'
+ 123 continue
+
+ read(str(2:1),'(i2,/,i2)',end=131, pad='no') a, b
+ call abort !stop 'ERROR: Expected EOF error (1)'
+ 131 continue
+
+ read(str2(:)(2:1),'(i2,/,i2)',end=132, pad='no') a, b
+ call abort !stop 'ERROR: Expected EOF error (2)'
+ 132 continue
+
+ read(str2(:)(2:1),'(i2,/,i2,/,i2)',end=133,pad='no') a, b, c
+ call abort !stop 'ERROR: Expected EOF error (3)'
+ 133 continue
+
+ read(str(2:1),'(i2,/,i2)',iostat=ios, pad='no') a, b
+ if (ios /= IOSTAT_END) call abort !stop 'ERROR: expected iostat /= 0 (1)'
+
+ read(str2(:)(2:1),'(i2,/,i2)',iostat=ios, pad='no') a, b
+ if (ios /= IOSTAT_END) call abort !stop 'ERROR: expected iostat /= 0 (2)'
+
+ read(str2(:)(2:1),'(i2,/,i2,/,i2)',iostat=ios,pad='no') a, b, c
+ if (ios /= IOSTAT_END) call abort !stop 'ERROR: expected iostat /= 0 (2)'
+
+ ! print *, "success"
+ end
+
+