]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/83525 (open(newunit=funit, status="scratch") fails if an internal file...
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Fri, 12 Jan 2018 20:01:47 +0000 (20:01 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Fri, 12 Jan 2018 20:01:47 +0000 (20:01 +0000)
2018-01-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/83525
        * gfortran.dg/newunit_5.f90: New test.

From-SVN: r256595

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

index b843cf6356f6f6f94415cadbd99031cf5b218061..7bec2dd8b10225d344921e7fa64faed2c824704e 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/83525
+       * gfortran.dg/newunit_5.f90: New test.
+
 2018-01-12  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/80481
diff --git a/gcc/testsuite/gfortran.dg/newunit_5.f90.f90 b/gcc/testsuite/gfortran.dg/newunit_5.f90.f90
new file mode 100644 (file)
index 0000000..5a238c4
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do run )
+! PR83525 Combination of newunit and internal unit was failing.
+program main
+  integer :: funit
+  logical :: isopen
+  integer :: this, another
+  character(len=:), allocatable :: message
+  
+  message = "12"
+  read(message, *) this
+  if (this.ne.12) call abort
+  
+  open(newunit=funit, status="scratch")
+  write(funit, *) "13"
+  rewind(funit)
+  read(funit, *) another
+  !write(*,*) another
+  close(funit)
+  if (another.ne.13) call abort
+end