This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] patch inquire statement on open direct access file
- From: Bud Davis <bdavis9659 at comcast dot net>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Tue, 30 Nov 2004 06:37:30 -0600
- Subject: [gfortran] patch inquire statement on open direct access file
this small patch, along with one just submitted by Tobi, fixes NIST
FM910.FOR
no additional regressions, tested i686/gnu/linux FC2.
this makes gfortran work just like g77 does wrt this topic.
--bud
2004-12-1 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.
! check to see that you cannot open a direct access file
! for sequential i/o.
! derived from NIST test fm910.for
CHARACTER*10 D4VK,CDIR
CDIR = 'TEMPFILE'
OPEN(FILE=CDIR, UNIT=7, ACCESS='DIRECT',RECL=132)
INQUIRE(UNIT=7,SEQUENTIAL=D4VK)
CLOSE(UNIT=7,STATUS='DELETE')
PRINT*,D4VK
END
Index: gcc/libgfortran/io/inquire.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/inquire.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 inquire.c
*** gcc/libgfortran/io/inquire.c 22 Jun 2004 00:43:55 -0000 1.4
--- gcc/libgfortran/io/inquire.c 30 Nov 2004 12:17:49 -0000
*************** inquire_via_unit (gfc_unit * u)
*** 73,80 ****
if (ioparm.sequential != NULL)
{
! p = (u == NULL) ? inquire_sequential (NULL, 0) :
! inquire_sequential (u->file, u->file_len);
cf_strcpy (ioparm.sequential, ioparm.sequential_len, p);
}
--- 73,85 ----
if (ioparm.sequential != NULL)
{
! // 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);
}