Navigation: Previous   Up   Next

5.2 Obsolete Extensions

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.

5.2.1 Byte Sizes

Byte sizes for 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)

5.2.2 TAB Format

The occurrence of a TAB character in fixed-form source is treated as follows:
  1. an initial TAB followed by a digit is expanded to 5 spaces (putting the digit in the continuation column),
  2. an initial TAB followed by any other character is expanded to 6 spaces (putting the character after the TAB in column 7, making the line the initial line of a statement), and
  3. other TAB characters are treated as single blanks except in character context where they remain TABs (but they are still treated as taking one column for the purposes of line length).

5.2.3 Hollerith Constants

Hollerith constants may be used as actual arguments or to initialise objects in DATA. In either case they must be associated with an object of intrinsic numeric data type, not with a 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.

5.2.4 D (debug) lines in Fixed Source Form

A line with the letter ‘D’ (or ‘d’) in column one is a D line. If the -d_lines option is used, this will be treated as a normal Fortran line, as if the D were a space. Otherwise, it will be treated as a comment line, as if the D were a C.

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.

5.2.5 Increased Line Length in Fixed Source Form

The -132 option increases the effective length of each fixed source form input line from 72 characters to 132 characters.

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.

5.2.6 Increased Maximum Number of Continuation Lines

The -maxcontin=N option increases the limit on the maximum number of continuation lines to N. Note that this option can affect both fixed source form and free source form, but never decreases the continuation line limit below the standard.

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.

5.2.7 Intrinsic functions with mixed-kind arguments

The 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)).

5.2.8 ACCESS='APPEND' specifier on OPEN statement

The VAX FORTRAN specifier ACCESS='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.

5.2.9 VAX FORTRAN TYPE statement

This statement has identical syntax and semantics to the PRINT 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.

5.2.10 Auto-skipping NAMELIST input

The Fortran standard requires that when namelist input is performed, the name after the ampersand in the input record must match the namelist group name (in the READ 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 PROGRAM
and 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]

5.2.11 Legacy Application Support

The -dusty option downgrades the category of common errors found in “legacy” software from “Error” to “Warning”, allowing such programs to be compiled and run. (The messages may be suppressed altogether by additionally specifying the -w option.)

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).

5.2.12 Mismatched Argument Lists

The -mismatch option downgrades checking of procedure argument lists so that inconsistencies between calls to routines which are not in the current file being processed produce warning messages rather than error messages.

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.

5.2.13 Double Precision Complex Extensions

Double precision complex entities may be declared with the 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.