XL Fortran allows many of the same FORTRAN 77 extensions as other popular compilers, including:
Extension | Refer to XL Fortran Advanced Edition V10.1 for Linux Language Reference Section(s) |
---|---|
Typeless constants | Typeless Literal Constants |
*len length specifiers for types | The Data Types |
BYTE data type | BYTE |
Long variable names | Names |
Lower case | Names |
Mixing integers and logicals (with -qintlog option) | Evaluation of Expressions |
Character-count Q edit descriptor (with -qqcount option) | Q (Character Count) Editing |
Intrinsics for counting set bits in registers and determining data-object parity | POPCNT, POPPAR |
64-bit data types (INTEGER(8), REAL(8), COMPLEX(8), and LOGICAL(8)), including support for default 64-bit types (with -qintsize and -qrealsize options) | Integer Real Complex Logical |
Integer POINTERs, similar to those supported by CRAY and Sun compilers. (XL Fortran integer pointer arithmetic uses increments of one byte, while the increment on CRAY computers is eight bytes. You may need to multiply pointer increments and decrements by eight to make programs ported from CRAY computers work properly.) | POINTER(integer) |
Conditional vector merge (CVMGx) intrinsic functions | CVMGx (TSOURCE, FSOURCE, MASK) |
Date and time service and utility functions (rtc, irtc, jdate, clock_, timef, and date) | Service and utility procedures |
STRUCTURE, UNION, and MAP constructs | Structure Components, Union and Map |
The -qctyplss option lets you use character constant expressions in the same places that you use typeless constants. The -qintlog option lets you use integer expressions where you can use logicals, and vice versa. A kind type parameter must not be replaced with a logical constant even if -qintlog is on, nor by a character constant even if -qctyplss is on, nor can it be a typeless constant.
Date and time routines, such as dtime, etime, and jdate, are accessible as Fortran subroutines.
A number of other popular routines from the libc library, such as flush, getenv, and system, are also accessible as Fortran subroutines.
For porting from machines with larger or smaller word sizes, the -qintsize option lets you specify the default size for integers and logicals. The -qrealsize option lets you specify the default size for reals and complex components.
If you have procedures with the same names as any XL Fortran intrinsic procedures, the program calls the intrinsic procedure. This situation is more likely with the addition of the many new Fortran 90, Fortran 95 and Fortran 2003 intrinsic procedures.
If you still want to call your procedure, add explicit interfaces, EXTERNAL statements, or PROCEDURE statements for any procedures with conflicting names, or use the -qextern option when compiling.
XL Fortran provides settings through the -qfloat option that help make floating-point results consistent with those from other IEEE systems; this subject is discussed in Duplicating the floating-point results of other systems.
XL Fortran supports a number of extensions to various language standards. Many of these extensions are so common that you need to keep in mind, when you port programs to other systems, that not all compilers have them. To find such extensions in your XL Fortran programs before beginning a porting effort, use the -qlanglvl option:
$ # -qnoobject stops the compiler after parsing all the source, $ # giving a fast way to check for errors. $ # Look for anything above the base F77 standard. $ xlf -qnoobject -qlanglvl=77std f77prog.f ... $ # Look for anything above the F90 standard. $ xlf90 -qnoobject -qlanglvl=90std use_in_2000.f ... $ # Look for anything above the F95 standard. $ xlf95 -qnoobject -qlanglvl=95std use_in_2000.f ...