PR libfortran/19872
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 11 Sep 2005 19:39:35 +0000 (19:39 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 11 Sep 2005 19:39:35 +0000 (19:39 +0000)
* gfortran.dg/overwrite_1.f: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104143 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 5006c7b..2b374e8 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-11  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR libfortran/19872
+       * gfortran.dg/overwrite_1.f: New test.
+
 2005-09-09  Josh Conner  <jconner@apple.com>
 
        * g++.dg/init/pr23180-1.C: Removed.
diff --git a/gcc/testsuite/gfortran.dg/overwrite_1.f b/gcc/testsuite/gfortran.dg/overwrite_1.f
new file mode 100644 (file)
index 0000000..dda9a8b
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do run } 
+! PR 19872 - closed and re-opened file not overwriten
+      implicit none
+      integer i(4)
+      data i / 4 * 0 /
+      open(1,form='FORMATTED',status='UNKNOWN')
+      write(1,'("1 2 3 4 5 6 7 8 9")')
+      close(1)
+      open(1,form='FORMATTED')
+      write(1,'("9 8 7 6")')
+      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
+! should only be able to read one line from the file
+      call abort
+ 200  continue
+      close(1,STATUS='DELETE')
+      end