aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2019-11-25 02:24:55 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2019-11-25 02:24:55 +0000
commitee1bc59e9d1b95102fb7092409885b3dcce9ea2a (patch)
treef0d70063934f27fec39ed6982f808c577041a2e2
parent8d6b4fe7e1d7b0bd46a5e39645afa897c9486e9b (diff)
downloadgcc-ee1bc59e9d1b95102fb7092409885b3dcce9ea2a.zip
gcc-ee1bc59e9d1b95102fb7092409885b3dcce9ea2a.tar.gz
gcc-ee1bc59e9d1b95102fb7092409885b3dcce9ea2a.tar.bz2
re PR libfortran/92100 (Formatted stream IO irreproducible read with binary data in file)
2019-11-24 Jerry DeLisle <jvdelisle@gcc.ngu.org> PR fortran/92100 gfortran.dg/streamio_18.f90: New test. From-SVN: r278664
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/streamio_18.f9023
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 823ceca..ca1527e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-24 Jerry DeLisle <jvdelisle@gcc.ngu.org>
+
+ PR fortran/92100
+ gfortran.dg/streamio_18.f90: New test.
+
2019-11-24 Bernd Schmidt <bernds_cb1@t-online.de>
* config/i386/i386.c (ix86_rtx_costs): Handle care of a PLUS in a
diff --git a/gcc/testsuite/gfortran.dg/streamio_18.f90 b/gcc/testsuite/gfortran.dg/streamio_18.f90
new file mode 100644
index 0000000..ee36238
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/streamio_18.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! PR91200
+program foo
+ implicit none
+ integer fd
+ open(newunit=fd, file='test.dat', access='stream', form='formatted')
+ write(fd,'(A)') '$MeshFormat'
+ write(fd,'(A)') 'aabbccdd'
+ close(fd)
+ call readfile ! Read test.dat
+contains
+ subroutine readfile
+ character(len=20) buf1, buf2
+ integer fd, m, n
+ open(newunit=fd, file='test.dat', access='stream', form='formatted')
+ inquire(fd, pos=m)
+ if (m /= 1) stop 'm /= 1'
+ read(fd, *) buf1
+ read(fd, *, pos=m) buf2 ! Reread by using pos=1
+ close(fd, status='delete')
+ if (buf1 /= buf2) stop 'wrong'
+ end subroutine readfile
+end program