From 708c4094eea2574473207a45d747994c9c2cbb56 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Fri, 12 Jan 2018 20:01:47 +0000 Subject: [PATCH] re PR fortran/83525 (open(newunit=funit, status="scratch") fails if an internal file (characters) was read previously.) 2018-01-12 Jerry DeLisle PR libgfortran/83525 * gfortran.dg/newunit_5.f90: New test. From-SVN: r256595 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/newunit_5.f90.f90 | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/newunit_5.f90.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b843cf6356f..7bec2dd8b10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-12 Jerry DeLisle + + PR libgfortran/83525 + * gfortran.dg/newunit_5.f90: New test. + 2018-01-12 Vladimir Makarov 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 index 00000000000..5a238c44036 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/newunit_5.f90.f90 @@ -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 -- 2.30.2