bug in gfortran and direct access files???

View: New views
2 Messages — Rating Filter:   Alert me  

bug in gfortran and direct access files???

by Vellieux Frederic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Fred. Vellieux

      PROGRAM TOTO
      IREC=1
      ISIZ1=1870
      OPEN(UNIT=23,ACCESS='SEQUENTIAL',STATUS='SCRATCH',
     .     FORM='UNFORMATTED',RECL=ISIZ1)
      WRITE(23,REC=IREC) IREC
      END

Re: bug in gfortran and direct access files???

by Steve Kargl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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