Fortran evolving into the next century

by Jeanne Adams


Fortran 90 is the current Fortran standard. After public reviews have been processed, Fortran 95, a modest evolution from Fortran 90, will become the new standard. A more ambitious set of proposals is planned for Fortran 2000, which will appear early in the next century. The goal of the ANSI committee is to have a new Fortran standard every five years.

Only three major new features are included in Fortran 95. These are:

  1. The FORALL statement and construct

  2. PURE and ELEMENTAL procedures

  3. Structure and pointer default initialization
Most of the other changes have arisen because of clarifications to the syntax and semantics of Fortran 90. A hardcopy of the draft currently under review is available on request for copying from Jeanne Adams, (303) 497-1275.


Language evolution

Fortran 90 provided a systematic way to allow for change and to continue to "promote portability, reliability, maintainability, and efficient execution of Fortran on a variety of computing systems." Fortran must grow and change with the times and old, little-used features must be removed from the standard as new features are added. It is not possible for a standard to add new features indefinitely, because the language becomes too large.

New features are defined in each standard revision cycle. These features often replace those that become archaic in the language and are rarely used. Occasionally, a new feature will make some facility redundant. In order to alert the user to redundant and seldom-used features, the older feature is declared obsolete. Obsolescent features then become candidates for deletion in the next standard revision.

The three classes of features that are considered when determining how Fortran will evolve are:

  1. New features
  2. Obsolescent features
  3. Deleted features
A summary of the new features of Fortran 95 follows. Subsequent articles will discuss the impact of some of these features.


New features in Fortran 95

New features provide facilities that describe new ways of solving old problems, and, in some cases, provide ways of dealing with evolving technology. An example would be the features added to make it easier to program for multiprocessors. The new features in Fortran 95 are briefly described below.

The FORALL statement and construct

The FORALL statement and the FORALL construct were discussed in the article "HPF FORALL statement allows parallel assignment of array elements" in the Fall/Winter 1993 SCD Computing News. The FORALL statement and construct provides a way to make parallel array assignments that are done simultaneously if the system is a multiprocessor. In addition, the FORALL statement and construct allows a larger class of array sections to be specified in the syntax. This feature was originally planned for Fortran 90, but was removed to reduce the size of the language. The Fortran 95 proposal is essentially the same as the one planned for Fortran 90. However, the inclusion of this feature does not require that the processor be a parallel machine. The FORALL concept follows the semantics of array assignments and the WHERE statements and constructs. (See "Extensions to the WHERE construct," below.)

PURE procedures

PURE is a procedure attribute added in response to the stated needs of high-performance parallel Fortran. If a procedure is declared PURE, there are no side effects such as modifying returned values, pointer associations, data mapping of arguments, or external I/O. In the body of a FORALL statement, for example, the procedures must be PURE, as well as in masked assignments, and for use within another PURE procedure.

ELEMENTAL procedures

ELEMENTAL is another procedure attribute. It allows a procedure with scalar dummy arguments to be called with array actual arguments, and results are produced for each element of the array on return. The array argument is applied element-by-element in no required order resulting in an array that is the same shape as the array argument. It is allowed in Fortran 90 for 64 intrinsic functions, such as sine and cosine, and one intrinsic subroutine. In Fortran 95, a simple extension allows user-defined procedures to be elemental.

User-defined functions in specification expressions

There is a restricted set of functions that may now occur in nonconstant specification expressions. These functions must be pure, not internal, and not recursive. They may be user-defined.

Extensions to the WHERE construct

Nesting a WHERE construct is not permitted in Fortran 90. To provide consistency and regularity with the FORALL construct, this restriction is removed. In Fortran 95, a WHERE construct may be nested within a FORALL construct, and a FORALL construct may be nested within a WHERE construct.

Default initialization

Default initialization may be specified for derived type data objects. Types with pointer components may be initialized as disassociated and therefore remain accessible. Using NULLIFY or the NULL intrinsic function before using the data is an alternative to initializing immediately. This goes a long way toward preventing memory leakage.

NULL intrinsic function

NULL is a new intrinsic function with a single optional argument. It allows pointers to be given an initial association status of "disassociated." This function can be used in a structure component in a structure constructor, or in a type statement in the specification part of a program.

CPU_TIME intrinsic subroutine

CPU_TIME is an intrinsic subroutine that measures processor time used by a program or a portion of a program. It returns a processor dependent number in seconds, and is not necessarily related to "wall clock" or the system clock. It is useful for comparisons. However, it is not very portable among different systems, since the result is processor dependent. As an extension, a version could be provided for parallel processing applications that would return an array of times.

Extensions to FLOOR, CEILING, MAXLOC and MINLOC intrinsic functions

FLOOR, CEILING, MAXLOC AND MINLOC are intrinsic functions that have been extended to relax the order requirements of the arguments MASK and DIM. A parallel processing application added the DIM function in a different order from the Fortran 90 standard, and in order to ensure portability for those applications that used a different order, these functions now allow arguments in any order.

Automatic deallocation of allocatable arrays

An allocatable array that is not saved in a particular program scope is deallocated as if a DEALLOCATE statement had been used. This was done to regularize the use of allocatable arrays and prevent memory leakages.

Namelist comments in namelist input

Namelist comments on input have been added to the namelist facility to allow for better documentation of programs. As with all comments, they are ignored by the program.

Minimum field widths

Output editing has been expanded to eliminate "white space" in numeric output. This extension allows output to be as small as possible, if a zero field width in I, B, O, Z, or F is used. Thus a monitor can hold the maximum number of numeric values.

Support for some aspects of IEEE 754/854 Standard

Historically, Fortran has never made a distinction between -0.0 and 0.0. This includes Fortran 66 and Fortran 77 as well as Fortran 90. In Fortran 95, a distinction is made between these values, and the results of 0./0. and 0.**0. are no longer an error. The SIGN function has been modified to produce a -0.0 . This was done in order to be compatible with the IEEE 754/854 standard, which does distinguish between -0.0 and 0.0.


Obsolescent features

Features in Fortran 90 that are redundant and seldom used make up the list of obsolescent features. Obsolescent features remain in the standard for the current revision cycle. They are candidates for deletion from the standard entirely at the next revision; however, they may be moved back to the main body of the standard and no longer on the obsolescent features list if they prove to be supported by a significant number of users. Or they can remain on the obsolescent features list and be neither deleted nor moved back to the main body of the standard.

In the list of obsolescent features in Fortran 90, three features remain obsolescent and five features were deleted. Six Fortran 90 features are proposed for addition to the list, making nine in all on the list proposed for Fortran 95. These features are condidates for deletion in the next draft standard planned for early next century. The obsolescent feature is entirely documented in the standard, but placed in a smaller font for identification. Programs that use these features are completely standard-conforming, although their use is discouraged. These nine obsolescent features are:

Arithmetic IF statement

A better method exists using the IF statement or construct which evaluates a scalar logical expression, testing for true or false. The arithmetic IF is error prone.

Shared DO termination

Shared DO is sometimes confusing in a nested DO. A better method is using an END DO or a CONTINUE statement.

Alternate return

The CASE construct, which may be based on a returned variable, is a better method avoiding an irregularity in the syntax of arguments in a procedure call by allowing statement labels in the call.

Computed GO TO

As with the alternate return facility, the CASE construct can be used. It is a better and more generalized facility that makes the computed GO TO redundant in the language.

Statement function

A better method is the use of the internal function. The statement function can be confused with an assignment statement, and is now redundant with an internal function which serves the same purpose.

DATA statements among executables

Beginning with Fortran 66, the DATA statement could appear anywhere in the program source code after the specification statements. For compatibility with Fortran 77, this relaxation of statement ordering remained in Fortran 90. However, it was discovered that this was seldom used, that DATA usually did not appear among executable statements, and that placing DATA among executable statements is error prone since the data is assigned during compilation and not during execution. This has now been prohibited.

Assumed-length character functions

Assumed character length functions are an irregularity of the language. Better methods exist (such as * in a specification statement) for achieving this feature.

Fixed-form source

A better method is the use of free-form source, which is more compatible with keyboard entry than the no-longer-used punch cards that depended on locating columns (6, 7, and 72) on a line for input. There are software tools for converting from fixed- to free-form source. It is redundant with free-form source.

Character * form of type declaration

This older form of specifying the length of character variables in type declarations is now redundant. Use the newer form.


Deleted features

The deleted features are taken from the obsolescent features list of the previous standard. They are redundant in the language and largely unused. Hollerith was a Fortran 66 feature that was removed from Fortran 77; no features were removed from Fortran 90. In Fortran 95, five features from the obsolescent features list of Fortran 90 were selected for deletion. These features are no longer documented in the main body of the standard; however, they are included in the appendix on "Decremental Features." Compiler writers who would include deleted features as extensions would have a source description of the syntax and semantics available for reference.

These five deleted features are:

Real and double-precision DO variables

A relaxation of the rules for the type of DO variables appeared in Fortran 77. It was continued in Fortran 90 for compatibility. When it was discovered that it was error prone and seldom used, it was deleted. DO variables in the Fortran 95 draft must be scalar integer type, that is, integer constants, variables, or expressions.

Branching to an END IF from outside the block

This relaxation was made in Fortran 77 and continued in Fortran 90. Better programs result if this feature is not used.

PAUSE statement

This feature is no longer current, nor is it used. It was based on operator intervention which is no longer done.

ASSIGN, assigned GO TO statement, assigned formats

These features have been deleted from the standard because they are irregular and complicate the documentation possibilities.

nH edit descriptor

This descriptor has finally been removed. It followed from the old Hollerith data deleted in Fortran 77. It was the only character string edit descriptor in Fortran 66.


Public review

The first United States public review for Fortran 95 occurred from July 7 through September 5, 1995. This review determined the United States position in the international arena. At that time, the United States voted NO, unless a long list of changes to the draft were approved. After the review, the document was changed based on these comments and comments from other countries as they established their positions. Some of these comments were accepted as changes to the draft standard and others were rejected at the international meeting in San Diego in November, 1995. The formal international review concluded September 28, 1995.

A final three-month international ballot will be scheduled in the spring of 1996. Only trivial changes, hopefully none at all, will be allowed after this ballot. If the balloting is successful, a new international standard will be announced by the International Standards Organization (ISO). If the balloting is unsuccessful, another round of public reviews will be scheduled.

This will be the first time that the procedures for standardizing Fortran are the international ones, and the US will participate as a member of the international body. (In previous standards, the US position determined the US standard, and the international body determined the international standard. These two procedures were different and it was difficult to reach an accord.) It is essential that the national and international standards for Fortran be identical.


Back to contents