The document you cite is not a language specification, it is a description of one particular compiler. The behaviour regarding the file fort.n
is compiler specific. For actual standard documents see https://stackoverflow.com/tags/fortran/info
Specifically, the Fortran 2008 says:
9.5.6.10 FILE= specifier in the OPEN statement
1 The value of the FILE= specifier is the name of the file to be connected to the
specified unit. Any trailing blanks are ignored. The file-name-expr
shall be a name that is allowed by the processor. If this specifier is
omitted and the unit is not connected to a file, the STATUS= specifier
shall be specified with a value of SCRATCH; in this case, the
connection is made to a processor-dependent file. The interpretation
of case is processor dependent.
That means that your program is not conforming, because when FILE=
is omited, the only permissible value of STATUS=
is "SCRATCH"
.
Gfortran also does create the fort.n
files when you write to a unit which you did not open, but not when you execute the open
statement with status="new"
. It should be easy for you to add the file=
specifier to the code. You can even use the fort.N
names if you insist on them. See Convert integers to strings to create output filenames at run time for the way how to get the integer into the file name.
Another option is to download the Oracle Solaris Studio, it contains the f77
command and is likely to follow the compiler specific document you have cited. It is actually quite a good compiler (if lacking some modern Fortran features) with very good visual debugging and profiling utilities. However, I recommend you to make your code portable and standard conforming first.