OSDN Git Service

2004-12-02 Bud Davis <bdavis9659@comcast.net>
authorbdavis <bdavis@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Dec 2004 04:13:21 +0000 (04:13 +0000)
committerbdavis <bdavis@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Dec 2004 04:13:21 +0000 (04:13 +0000)
        * io/inquire.c (inquire_via_unit): do not allow a direct access
        file to be opened for sequential I/O.

        * gfortran.dg/inquire.f90: New test.

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

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

index 5a5d84a..2db19aa 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-02  Bud Davis  <bdavis9659@comcast.net>
+
+       * gfortran.dg/inquire.f90: New test.
+
 2004-12-01  Janis Johnson  <janis187@us.ibm.com>
 
        * lib/gcc-dg.exp (dg-process-target): Wrapper for dg function to
diff --git a/gcc/testsuite/gfortran.dg/inquire.f90 b/gcc/testsuite/gfortran.dg/inquire.f90
new file mode 100644 (file)
index 0000000..9f3b725
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do run }
+! check to see that you cannot open a direct access file
+! for sequential i/o.
+! derived from NIST test fm910.for
+        IMPLICIT NONE
+        CHARACTER*10 D4VK
+        OPEN(UNIT=7, ACCESS='DIRECT',RECL=132,STATUS='SCRATCH')
+        INQUIRE(UNIT=7,SEQUENTIAL=D4VK)
+        CLOSE(UNIT=7,STATUS='DELETE')
+        IF (D4VK.NE.'NO') CALL ABORT
+        END
index 179ed9b..e90c0fa 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-02  Bud Davis  <bdavis9659@comcast.net>
+
+       * io/inquire.c (inquire_via_unit): do not allow a direct access
+       file to be opened for sequential I/O.
+
 2004-12-02  Steven G. Kargl  <kargls@comcast.net>
        Paul Brook  <paul@codesourcery.com>
 
index 36957dd..a93f99d 100644 (file)
@@ -73,8 +73,13 @@ inquire_via_unit (gfc_unit * u)
 
   if (ioparm.sequential != NULL)
     {
-      p = (u == NULL) ? inquire_sequential (NULL, 0) :
-       inquire_sequential (u->file, u->file_len);
+      /* disallow an open direct access file to be accessed
+         sequentially */
+      if (u->flags.access==ACCESS_DIRECT)
+        p = "NO";
+      else   
+        p = (u == NULL) ? inquire_sequential (NULL, 0) :
+        inquire_sequential (u->file, u->file_len);
 
       cf_strcpy (ioparm.sequential, ioparm.sequential_len, p);
     }