summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/direct_io_10.f
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/direct_io_10.f
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/direct_io_10.f')
-rw-r--r--gcc/testsuite/gfortran.dg/direct_io_10.f46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/direct_io_10.f b/gcc/testsuite/gfortran.dg/direct_io_10.f
new file mode 100644
index 000000000..c47027208
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/direct_io_10.f
@@ -0,0 +1,46 @@
+! { dg-do run }
+! pr35699 run-time abort writing zero sized section to direct access file
+ program directio
+ call qi0010 ( 10, 1, 2, 3, 4, 9, 2)
+ end
+
+ subroutine qi0010 (nf10, nf1, nf2, nf3, nf4,nf9, np2)
+ character(10) bda(nf10)
+ character(10) bda1(nf10), bval
+
+ integer j_len
+ bda1(1) = 'x'
+ do i = 2,10
+ bda1(i) = 'x'//bda1(i-1)
+ enddo
+ bda = 'unread'
+
+ inquire(iolength = j_len) bda1(nf1:nf10:nf2), bda1(nf4:nf3),
+ $ bda1(nf2:nf10:nf2)
+
+ open (unit=48,
+ $ access='direct',
+ $ status='scratch',
+ $ recl = j_len,
+ $ iostat = istat,
+ $ form='unformatted',
+ $ action='readwrite')
+
+ write (48,iostat = istat, rec = 3) bda1(nf1:nf10:nf2),
+ $ bda1(nf4:nf3), bda1(nf2:nf10:nf2)
+ if ( istat .ne. 0) then
+ call abort
+ endif
+ istat = -314
+
+ read (48,iostat = istat, rec = np2+1) bda(nf1:nf9:nf2),
+ $ bda(nf4:nf3), bda(nf2:nf10:nf2)
+ if ( istat .ne. 0) then
+ call abort
+ endif
+
+ do j1 = 1,10
+ bval = bda1(j1)
+ if (bda(j1) .ne. bval) call abort
+ enddo
+ end subroutine