f95 accepts the following non-standard features of the FORTRAN 77 compiler, f77, either directly or when compiling in -f77 compatibility mode:
Continuation lines can start with ”&’ in column 1. [-f77=misc]
The first line in an include file can be a continuation line. [-f77=misc]
Use f77 tab-format. [-f77=tab]
Tab-formatting can extend source lines beyond column 72. [-f77=tab]
f95 tab-formatting will not pad character strings to column 72 if they extend over a continuation line. [-f77]
You can open a file with ACCESS=’APPEND’ in Fortran 95.
List-directed output uses formats similar to the f77 compiler. [-f77=output]
f95 allows BACKSPACE on a direct-access file, but not ENDFILE.
f95 allows implicit field-width specifications in format edit descriptors. For example, FORMAT(I) is allowed.
f95 will recognize f77 escape sequences (for example, \n \t \’) in output formats. [-f77=backslash.]
f95 recognizes FILEOPT= in OPEN statements.
f95 allows SCRATCH files to be closed with STATUS=’KEEP’ [-f77]. When the program exits, the scratch file is not deleted. SCRATCH files can also be opened with FILE=name when compiled with -f77.
Direct I/O is permitted on internal files. [-f77]
f95 recognizes FORTRAN 77 format edit descriptors A, $, and SU. [-f77]
FORM=’PRINT’ can appear on OPEN statements. [-f77]
f95 recognizes the legacy FORTRAN input/output statements ACCEPT and TYPE.
Compile with -f77=output to write FORTRAN 77 style NAMELIST output.
A READ with only ERR= specified (no IOSTAT= or END= branches) treats the ERR= branch as an END= when an EOF is detected. [-f77]
VMS Fortran NAME=’filename’ is accepted on OPEN statements. [-f77]
f95 accepts an extra comma after READ() or WRITE(). [-f77]
END= branch can appear on direct access READ with REC=. [-f77=input]
Allow format edit descriptor Ew.d.e and treat it as Ew.d.Ee. [-f77]
Character strings can be used in the FORMAT of an input statement. [-f77=input]
IOSTAT= specifier can appear in ENCODE/DECODE statements.
List-directed I/O is allowed with ENCODE/DECODE statements.
Asterisk (*) can be used to stand in for STDIN and STDOUT when used as a logical unit in an I/O statement.
Arrays can appear in the FMT= specifier. [-f77=misc]
PRINT statement accepts namelist group names. [-f77=output]
The compiler accepts redundant commas in FORMAT statements.
While performing NAMELIST input, entering a question mark (?) responds with the name of the namelist group being read. [-f77=input]
Data Types, Declarations, and Usage:
In a program unit, the IMPLICIT statement may follow any other declarative statement in the unit.
f95 accepts the IMPLICIT UNDEFINED statement.
f95 accepts the AUTOMATIC statement, a FORTRAN 77 extension.
f95 accepts the STATIC statement and treats it like a SAVE statement.
f95 accepts VAX STRUCTURE, UNION, and MAP statements.(See 4.4 STRUCTURE and UNION (VAX Fortran))
LOGICAL and INTEGER variables can be used interchangeably. [-f77=logical]
INTEGER variables can appear in conditional expressions, such as DO WHILE. [-f77=logical]
Cray pointers can appear in calls to intrinsic functions.
f95 will accept data initializations using slashes on type declarations. For example: REAL MHW/100.101/, ICOMX/32.223/
f95 allows assigning Cray character pointers to non-pointer variables and to other Cray pointers that are not character pointers.
f95 allows the same Cray pointer to point to items of different type sizes (for example, REAL*8 and INTEGER*4).
A Cray pointer can be declared INTEGER in the same program unit where it is declared as a POINTER. The INTEGER declaration is ignored. [-f77=misc]
A Cray pointer can be used in division and multiplication operations. [-f77=misc]
Variables in an ASSIGN statement can be of type INTEGER*2. [-f77=misc]
Expressions in alternate RETURN statements can be non-integer type. [-f77=misc]
Variables with the SAVE attribute can be equivalenced to an element of a COMMON block.
Initializers for the same array can be of different types. Example:REAL*8 ARR(5) /12.3 1, 3, 5.D0, 9/
Type declarations for namelist items can follow the NAMELIST statement.
f95 accepts the BYTE data type.
f95 allows non-integers to be used as array subscripts. [-f77=subscript]
f95 allows relational operators .EQ. and .NE. to be used with logical operands. [-f77=logical]
f95 will accept the legacy f77 VIRTUAL statement, and treats it as a DIMENSION statement.
Different data structures can be equivalenced in a manner that is compatible with the f77 compiler. [-f77=misc]
Like the f77 compiler, f95 allows many intrinsics to appear in initialization expressions on PARAMETER statements.
f95 allows assignment of an integer value to CHARACTER*1 variables. [-f77=misc]
BOZ constants can be used as exponents. [-f77=misc]
BOZ constants can be assigned to character variables. For example: character*8 ch ch ="12345678"X
BOZ constants can be used as arguments to intrinsic function calls. [-f77=misc]
A character variable can be initialized with an integer value in a DATA statement. The first character in the variable is set to the integer value and the rest of the string, if longer than one character, is blank-filled.
An integer array of hollerith characters can be used as a format descriptor. [-f77].
Constant folding will not be done at compile time if it results in a floating-point exception. [-f77=misc]
When compiling with -f77=misc, f95 will automatically promote a REAL constant to the appropriate kind (REAL*8 or REAL*16) in assignments, data, and parameter statements, in the manner of the f77 compiler. [-f77=misc]
Equivalenced variables are allowed on an assigned GOTO. [-f77]
Non-constant character expressions can be assigned to numeric variables.
Compiling with -f77=misc allows *kind after the variable name in type declarations. [-f77=misc]. For example REAL Y*4, X*8(21)) INTEGER FUNCTION FOO*8(J)
A character substring may appear as an implied-DO target in a DATA statement. [-f77=misc]For example: DATA (a(i:i), i=1,n) /n*’+’/
Integer expressions within parentheses can appear as a type size. For example: PARAMETER (N=2) INTEGER*(N+2) K
Programs, Subroutines, Functions, and Executable Statements:
f95 does not require a PROGRAM statement to have a name.
Functions can be called by a CALL statement as if they were subroutines. [-f77]
Functions do not have to have their return value defined. [-f77]
An alternate return specifier (*label or &label) can appear in the actual parameter list and in different positions. [-f77=misc]
%VAL can be used with an argument of type COMPLEX. [-f77=misc]
%REF and %LOC are available. [-f77=misc]
A subroutine can call itself recursively without declaring itself with a RECURSIVE keyword. [-f77=misc] However, programs that perform indirect recursion (routine A calls routine B which then calls routine A) should also be compiled with the -xrecursive flag to work correctly.
A subroutine with alternate returns can be called even when the dummy argument list does not have an alternate return list.
Compiling with -f77=misc allows statement functions to be defined with arguments typed other than INTEGER or REAL, and actual arguments will be converted to the type defined by the statement function. [-f77=misc]
Allow null actual arguments. For example: CALL FOO(I,,,J) has two null arguments between the first I and the final J argument.
f95 treats a call to the function %LOC() as a call to LOC(). [-f77=misc]
Allow unary plus and unary minus after another operator such as ** or *.
Allow a second argument with the CMPLX() intrinsic function even when the first argument is a COMPLEX type. In this case, the real part of the first argument is used. [-f77=misc]
Allow the argument to the CHAR() intrinsic function to exceed 255 with only a warning, not an error. [-f77=misc]
Allow negative shift counts with only a warning, not an error.
Search for an INCLUDE file in the current directory as well as those specified in the -I option. [-f77=misc]
Allow consecutive .NOT. operations, such as .NOT..NOT..NOT.(I.EQ.J). [-f77=misc]
The f95 compiler normally does not issue progress messages to standard out. The f77 compiler did issue progress messages, displaying the names of the routines it was compiling. This convention is retained when compiling with the -f77 compatibility flag.
Programs compiled by the f77 compiler did not trap on arithmetic exceptions, and automatically called ieee_retrospective on exit to report on any exceptions that may have occured during execution. Compiling with the -f77 flag mimics this behavior of the f77 compiler. By default, the f95 compiler traps on the first arithmetic exception encountered and does not call ieee_retrospective.
The f77 compiler treated a REAL*4 constant as if it had higher precision in contexts where higher precision was needed. When compiling with the -f77 flag, the f95 compiler allows a REAL*4 constant to have double or quad precision when the constant is used with a double or quad precision operand, respectively.
Allow the DO loop variable to be redefined within the loop. [-f77=misc]
Display the names of program units being compiled. [-f77=misc]
Allow the types of the variables used in a DIMENSION statement to be declared after the DIMENSION statement. Example:
SUBROUTINE FOO(ARR,G) DIMENSION ARR(G) INTEGER G RETURN END
For details on the syntax and semantics of non-standard language extensions, see the FORTRAN 77 Language Reference at http://docs.sun.com/source/806-3594/index.html.