This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fortran standard question: open()


On Wednesday 24 November 2004 17:06, Steve Ellcey wrote:
> I have noticed a difference between the HP Fortran compiler and gfortran
> and was wondering if someone familiar with the Fortran standard could
> tell me if this is a bug or just an implementation difference.
>
> If we have the following program:
>
>       OPEN(10,FILE='wup.in',STATUS='OLD')
>       CLOSE(10, STATUS='KEEP')
>       END
>
> And a data file that is readable by everyone and writable by nobody:
>
> $ ll wup.in
> -r--r--r--   1 sje        other             0 Nov 24 08:43 wup.in
>
>
> Then when I use the HP compiler to build the program it runs fine, but
> if I use gfortran, it fails.  Obviously gfortran is trying to open the
> file for reading and writing (since I didn't specify) and the open is
> failing.  If I give myself write permssion to the file, the gfortran
> compiled program runs fine.
>
> Is this a compiler bug?

Section 9.3.4.8 says that the default value for ACTION= in an open statement 
is processor dependent. This basically means the compiler gets to decide what 
it wants to do.

g77 and Intel Fortran agree with HP Fortran, so I consider this a bug even 
though it isn't technically required by the standard.

Please file a bug report.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]