]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2018-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 18 Feb 2018 15:32:39 +0000 (15:32 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 18 Feb 2018 15:32:39 +0000 (15:32 +0000)
PR libgfortran/84412
* io/transfer.c (finalize_transfer): After completng an internal unit
I/O operation, clear internal_unit_kind.

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

gcc/testsuite/gfortran.dg/inquire_18.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/transfer.c

diff --git a/gcc/testsuite/gfortran.dg/inquire_18.f90 b/gcc/testsuite/gfortran.dg/inquire_18.f90
new file mode 100644 (file)
index 0000000..9829688
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do run }
+! PR84412 Wrong "Inquire statement identifies an internal file" error 
+program bug
+  implicit none
+  integer          :: i
+  character(len=1) :: s
+  write (s,'(i1)') 0
+  open(newUnit=i,file='inquire_18.txt',status='unknown')
+  inquire(unit=i)
+  close(i, status="delete")
+end program bug
index 2220ec2bae63a8548a36bcb8fcb6a9a1c17235b8..20a13e46a4f50af10b762815370c2c85785c396c 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/84412
+       * io/transfer.c (finalize_transfer): After completng an internal unit
+       I/O operation, clear internal_unit_kind.
+
 2018-02-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * libgfortran.h (GFC_ARRAY_DESCRIPTOR): Remove dimension
index 8bc828c02146f8183013627347bdc62c83f04c49..df33bed1561db6a55ec114e90bf4254817a98754 100644 (file)
@@ -3993,6 +3993,10 @@ finalize_transfer (st_parameter_dt *dtp)
 
   if (dtp->u.p.unit_is_internal)
     {
+      /* The unit structure may be reused later so clear the
+        internal unit kind.  */
+      dtp->u.p.current_unit->internal_unit_kind = 0;
+
       fbuf_destroy (dtp->u.p.current_unit);
       if (dtp->u.p.current_unit
          && (dtp->u.p.current_unit->child_dtio  == 0)