Enhanced support for Fortran 2003
Beginning with the V8.1 release, XL Fortran has delivered many Fortran 2003 standard features, including:
- BIND(C) for portable interoperability with C code
- Allocatable objects beyond just Fortran 95 arrays
- Stream I/O support
- ASSOCIATE and ENUM statements
- READ with BLANK= and PAD= specifiers
- WRITE with DELIM= specifier
- IEEE and Fortran environment modules
This release of XL Fortran builds on that work to arrive at the most complete Fortran 2003 implementation currently available, with Derived Type Parameters being the only major feature not yet implemented.
Fortran 2003 compiler invocations
New compiler invocation commands instruct the compiler to adhere more closely to Fortran 2003 language standards when compiling your applications. The new invocations are:
- xlf2003
- xlf2003_r (for threaded applications)
- f2003
These invocations provide partial compliance to the Fortran 2003 standard. You can obtain full compliance to the Fortran 2003 standard by doing the following:
1. Set the XLFRTEOPTS environment variable to:
err_recovery=no:langlvl=2003std:iostat_end=2003std:internal_nldelim=2003std
2. Invoke the compiler with the following option settings:
-qlanglvl=2003std -qnodirective -qnoescape -qextname
-qfloat=nomaf:rndsngl:nofold -qnoswapomp -qstrictieeemod
Fortran 2003 file types
In addition to new compiler invocations, this release of XL Fortran also adds support for new filename extensions:
- .f03
- .F03 (invokes the C preprocessor before compiling)
Compiler option -qxlf2003
XL Fortran adds a new compatibility option, -qxlf2003. This option provides backward compatibility with XL Fortran V10.1 and the Fortran 2003 standard for certain aspects of the language.
When compiling with the xlf2003, xlf2003_r, or f2003 compiler invocations, the default setting is -qxlf2003=polymorphic. This setting instructs the compiler to allow polymorphic items such as the CLASS type specifier and SELECT TYPE construct in your Fortran application source. For all other compiler invocations, the default is -qxlf2003=nopolymorphic.
The -qxlf2003 compiler option also includes several other suboptions to provide backward compatibility with earlier versions of XL Fortran.
Additional Fortran 2003 enhancements
Significant enhancements introduced with XL Fortran V11.1 include:
- Implementation of the full Fortran 2003 object-oriented programming model, including:
- Type extension
- Type-bound procedures
- Type finalization
- Polymorphism and runtime type determination including the SELECT TYPE construct
- Abstract and generic interfaces
- Declaration of abstract types and deferred bindings
- PASS attribute
- I/O enhancements
- User-defined derived type I/O
- New I/O specifiers including SIGN= and DECIMAL= (DC and DP edit descriptors)
- Asynchonous I/O as defined by Fortran 2003 including the WAIT statement
- User-specifed control of rounding during format conversion using the ROUND= specifier and new edit descriptors
- Handling of IEEE infinity and not-a-number in REAL and COMPLEX editing
- Support of PAD= specifier on INQUIRE operations
- Scoping and data manipulation enhancements
- Renaming of defined operators on USE statements
- Fortran 2003 VOLATILE statement
- MAX, MIN, MAXLOC, MINLOC, MAXVAL, and MINVAL intrinsics for character types
- COMPLEX literals
- Pointer assignment and initialization expression enhancements
- Improved structure constructors
- Allocatable enhancements including resizing on assignment and MOVE_ALLOC intrinsic
- Explicit type specification in an array constructor
- Procedure enhancements
- Generic bindings for interfaces, defined operators, and defined assignment
- VALUE attribute for characters of length greater than one and derived types with allocatable components
- Procedure pointers, procedure declaration statement, and procedure pointers as derived type components
- Generalization of the MODULE PROCEDURE statement
- Deferred CHARACTER length
- Intrinsic function enhancements
- Allow REAL type for COUNT_RATE argument of SYSTEM_CLOCK
- Allow boz-literal constants on INT, REAL, CMPLX, and DBL intrinsics
- Allow a new KIND argument on all instrinsics mandated by Fortran 2003
- Returning signed zero results from the ATAN2, LOG, and SQRT intrinsics
- Added SELECTED_CHAR_KIND intrinsic
- Other enhancements
- Enhanced STOP statement
- Increased the maximum number of continuation lines