inquire.c (inquire_via_unit): do not allow a direct access file to be opened for sequential I/O.

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.

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

From-SVN: r91610
This commit is contained in:
Bud Davis 2004-12-02 04:13:21 +00:00 committed by Bud Davis
parent df65f0938c
commit 8dc4d66aa7
4 changed files with 27 additions and 2 deletions

View 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

View File

@ -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

View 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>

View 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);
}