The following extensions were common in the Fortran 77 era, and are still in frequent use (though they have been superseded and are thus unnecessary). Warning messages (marked ‘Extension:’) are produced for each occurrence of any extension; these particular ones may be suppressed with the -w=x77 option.
REAL
, INTEGER
, LOGICAL
and COMPLEX
are accepted and mapped to Modern Fortran KINDS.
Byte Size Specification | Standard Fortran | Using F90_KIND or ISO_FORTRAN_ENV |
REAL*2 | Real | Real(real16) |
REAL*4 | Real | Real(real32) |
REAL*8 | Double Precision | Real(real64) |
REAL*16 | Real(Selected_Real_Kind(30)) | Real(real128) |
COMPLEX*4 | Complex(Selected_Real_Kind(3)) | Complex(real16) |
COMPLEX*8 | Complex | Complex(real32) |
COMPLEX*16 | Complex(Kind(0d0)) | Complex(real64) |
COMPLEX*32 | Complex(Selected_Real_Kind(30)) | Complex(real128) |
INTEGER*1 | Integer(Selected_Int_Kind(2)) | Integer(int8) |
INTEGER*2 | Integer(Selected_Int_Kind(4)) | Integer(int16) |
INTEGER*4 | Integer | Integer(int32) |
INTEGER*8 | Integer(Selected_Int_Kind(18)) | Integer(int64) |
Byte Size Specification | Standard Fortran | Using F90_KIND |
LOGICAL*1 | Logical(byte) | |
LOGICAL*2 | Logical(twobyte) | |
LOGICAL*4 | Logical | Logical(word) |
LOGICAL*8 | Logical(logical64) |
The byte length may also be overridden in the type declaration, similar to overriding the character length. For example,
REAL X*4, Y*(8)
CHARACTER
or derived type object.
Hollerith i/o (i.e., use of the A edit descriptor with non-CHARACTER
data) is only enabled if the using subprogram was compiled with the
-hollerith_io or -dusty option.
For example, in
SUBROUTINE TEST(N) INTEGER N D PRINT *,'TESTING N' ...the
PRINT
statement will be compiled only if -d_lines
is used.
Note that if the initial line of a statement is a D line, any continuation lines it may have must also be D lines. Similarly, if the initial line of a statement is not a D line, any continuation lines must not be D lines.
A D line can use TAB format, with the TAB expanding to one less space as the letter D already accounts for a space.
Note that when this option is used the NAG Fortran Compiler no longer conforms to the Fortran language standard. The meaning of a program will change if it contains a character constant which is continued across a line boundary. A standard-conforming program containing an H-edit descriptor which is continued across a line boundary will very likely be rejected.
For new Fortran programs we recommend the use of free source form instead of this option. Free source form provides superior detection of typographical errors and is also part of the Fortran standard and thus fully portable to all standard-conforming compilers.
The Fortran 90 and 95 standards specified that the maximum number of continuation lines in fixed source form was 19, and that the maximum number of continuation lines in free source form was 39. The Fortran 2003 standard increased this to 255 lines regardless of source form.
ATAN
, ATAN2
, DIM
, MAX
, MIN
, MOD
,
MODULO
and SIGN
intrinsic functions will accept integer and real
arguments that differ in kind; note that integer and real arguments still
cannot be mixed in a single intrinsic function reference.
For SIGN
, the kind of the result is the same as the kind of the first
argument (which supplies the magnitude of the result), ignoring the kind of the
second argument (which only supplies the sign of the result).
For all the others, the kind of the result is the same as for
arithmetic operations, i.e. for integers the kind with the largest number of
digits, and for reals the kind with the greatest precision.
For example, if X
is REAL(real32)
and Y
is
REAL(real64)
:
MAX(X,Y) has kind real64 and its value is equal to MAX(REAL(X,real64),Y) ; |
SIGN(X,Y) has kind real32 and its value is equal to SIGN(X,REAL(SIGN(1.0_real64,Y),real32)) . |
ACCESS='APPEND'
specifier on OPEN
statementACCESS='APPEND'
can be used on the OPEN
statement.
It is equivalent to specifying both ACCESS='SEQUENTIAL'
and POSITION='APPEND'
.
For example,
OPEN(17,FILE='my.log',ACCESS='APPEND')has the same effect as
OPEN(17,FILE='my.log',POSITION='APPEND') ! ACCESS='SEQUENTIAL' is the default.
This is supported only as an aid to porting old programs; it should be changed to the
POSITION='APPEND'
specifier.
TYPE
statementPRINT
statement,
except that the keyword TYPE
is used instead of PRINT
.
Some forms of this statement where the format begins with a name are ambiguous
with respect to a derived type definition,
and those forms are only treated as a TYPE
statement if that name is used or
declared earlier in the scoping unit; otherwise, it is treated as a derived type
definition.
For example,
TYPE *,'Hello'is equivalent to
PRINT *,'Hello'
Processing a source file containing VAX FORTRAN TYPE
statements with the
enhanced polisher will turn all TYPE
statements into PRINT
statements.
The ordinary polisher will not change any TYPE
statements; furthermore, if one
of the ambiguous forms is used, the remainder of the file will be incorrectly indented,
as the ordinary polisher does not have semantic analysis and therefore assumes the
ambiguous form is the beginning of a type definition.
NAMELIST
inputREAD
statement).
However, a common extension is for the i/o library to “skip forwards” in the file,
looking for an input record that matches namelist initial record required.
Normally, the NAG Fortran system raises an i/o error condition if the names do not match, but when auto-skipping namelist input is in effect, instead it skips records until it reaches the end of the file or finds a record that begins with an ampersand and the correct name.
For example, given the program
PROGRAM asnl INTEGER x,y NAMELIST/name/x,y READ(*,name) PRINT *,'Result',x,y END PROGRAMand the input data
&wrong x = 999 y = -999 / &name x = 123 y = 456 /with auto-skipping namelist it will print
Result 123 456
Auto-skipping namelist is controlled by runtime options.
The environment variable NAGFORTRAN_RUNTIME_OPTIONS
contains a comma-separated
list of runtime options; auto-skipping namelist is enabled by the option autoskip_namelist or
log_autoskip_namelist.
The latter option produces an informative message to standard error, displaying where the namelist input occurred, for example:
[example.f90, line 5: Looking for namelist group NAME, skipping WRONG]
This option also effectively provides the extensions of allowing COMMON
blocks to be initialised outside of BLOCK DATA
, and of accepting VAX
format octal and hexadecimal constants (these have the forms '...'O
and
'...'X
respectively).
The -mismatch_all option further downgrades argument list checking so that incorrect calls to routines present in the current file being processed produce warning messages instead of error messages.
DOUBLE COMPLEX
keywords instead of the standard Fortran ‘Complex(Kind(0d0))
’
specification.
If the -dcfuns option has been used, additional intrinsic functions are available (see the documentation of the option for full details). These functions have all been redundant since Fortran 90.