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 gfortran will fail on the open (because it tries to open for read & write), other compilers will open for read-only if they cannot open for reading and writing. Opening for read-only is not required by the Fortran standard but it is how most Fortran compilers (HP, Intel, g77) behave.
Confirmed, I will reopen the other bug and close it as a dup of this one.
*** Bug 18297 has been marked as a duplicate of this bug. ***
This has been fixed with the patch http://gcc.gnu.org/ml/fortran/2004-12/msg00017.html which is now checked in on ToT.
Fixed by: 2004-12-07 Steve Ellcey <sje@cup.hp.com> * io/io.h (open_external): Change prototype. * io/unix.c (regular_file): Change prototype and set flags->action if needed. (open_external): Ditto. * io/open.c (new_unit): Let open_external set flags->action.