This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: bug in gfortran and direct access files???
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Vellieux Frederic <Frederic dot Vellieux at ibs dot fr>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 2 Nov 2009 09:22:05 -0800
- Subject: Re: bug in gfortran and direct access files???
- References: <4AEF0FA1.4040405@ibs.fr>
On Mon, Nov 02, 2009 at 05:58:09PM +0100, Vellieux Frederic wrote:
> Dear gfortran developers,
>
> I have a problem with writing to direct access files using gfortran (get
> a run time error, "Fortran runtime error: Record number not allowed for
> sequential access data transfer").
>
> The error does not occur with code compiled using g77.
>
> I am enclosing herewith a small program that gives this error.
>
The code is non-conforming. From the Fortran 2003 Standard.
9.5.1.11 REC= specifier in a data transfer statement
The REC= specifier specifies the number of the record that is to be
read or written. This specifier may appear only in an input/output
statement that specifies a unit connected for direct access; ...
PROGRAM TOTO
IREC=1
ISIZ1=1870
OPEN(UNIT=23,ACCESS='SEQUENTIAL',STATUS='SCRATCH',
. FORM='UNFORMATTED',RECL=ISIZ1)
WRITE(23,REC=IREC) IREC
END
Your code clearly specifies SEQUENTIAL access, so gfortran
reports the error. Change SEQUENTIAL to DIRECT.
--
Steve