fortran 95 and beyond

6
ELSEVIER Computer Standards & Interfaces 18 (1996) 30% 3 I4 Fortran 95 and beyond Richard Kelble Uruqs Corporumm, 2476 Swede.rford Road. PO Box 203. Puoii. PA 19301. US.4 Abstract This article discusses the plans for the future evolution of the Fortran Language. The topics covered are: 1) The process that will govern the future revisions of the standard; 2) Some of the history of the development of that process; 3) The evolution of the Fortran 95 feature set; 4) A description of the features included in Fortran 95; 5) The beginnings of the Fonran 2000 feature set; and 6) Information on the submission of reqturements for a future revision. Keywords: Fortran 95 features: Fortran 95 evolution; Future revisions of Fonran 1. Creating the plan for the future As Fortran 90 was undergoing the approval pro- cess within IS0 and ANSI, WC5 began turning their attention to future revisions of the Fortran Program- ming Language. At its August 1990 meeting WG5 adopted a resolution that established the objective of evolving the Fortran Language beyond Fortran 90. In addition, this resolution requested the members to submit sug- gestions for the procedures to follow in accomplish- ing this objective. WC5 set aside some time at their March and July 1991 meetings to review these sug- gestions. The primary objective of the March 1991 meeting was the finalization of Fortran 90. With the work of Fortran 90 complete, WC5 was able to place more emphasis on the future of the Fortran Language at the July 1991 meeting. A resolution was adopted at the July meeting establishing a subgroup to develop a management plan and procedures for the future evolution of Fortran standards. The resulting draft plan was balloted by the members prior to the July 1992 meeting. With the results of the ballot available Elsevier Science B.V. PII SO920-5489(96)0 1007-O at the July 1992 meeting, WG5 could then finalize this plan and get the process started. Several resolutions related to the evolution of the Fortran Language were adopted at the July 1992 meeting. Most importantly, the paper, “Strategic Plan for Fortran Standardization,” produced by the subgroup established at the last meeting was adopted as a standing document of the committee after con- sidering the comments from the ballot. An editor was named for the database of functional needs and suggested requirements for future revisions of the Fortran standard. X3J3 was invited to serve as the development body for the near-term revision, which is to be known as Fortran 95. The Strategic Plan declared the mission of the standardization bodies to be responsive to changing technology and user needs by establishing proce- dures whereby a revision of the International Fortran standard is produced about every five years. After taking nearly three times that long to produce For- tran 90, the five year guideline was well received by the Fortran users on the committee. No longer would they have to wait seemingly forever for new features to appear in the standard. The Strategic Plan also

Upload: richard-kelble

Post on 02-Sep-2016

214 views

Category:

Documents


2 download

TRANSCRIPT

ELSEVIER Computer Standards & Interfaces 18 (1996) 30% 3 I4

Fortran 95 and beyond Richard Kelble

Uruqs Corporumm, 2476 Swede.rford Road. PO Box 203. Puoii. PA 19301. US.4

Abstract

This article discusses the plans for the future evolution of the Fortran Language. The topics covered are: 1) The process that will govern the future revisions of the standard; 2) Some of the history of the development of that process; 3) The evolution of the Fortran 95 feature set; 4) A description of the features included in Fortran 95; 5) The beginnings of the Fonran 2000 feature set; and 6) Information on the submission of reqturements for a future revision.

Keywords: Fortran 95 features: Fortran 95 evolution; Future revisions of Fonran

1. Creating the plan for the future

As Fortran 90 was undergoing the approval pro- cess within IS0 and ANSI, WC5 began turning their attention to future revisions of the Fortran Program- ming Language.

At its August 1990 meeting WG5 adopted a resolution that established the objective of evolving the Fortran Language beyond Fortran 90. In addition, this resolution requested the members to submit sug- gestions for the procedures to follow in accomplish- ing this objective. WC5 set aside some time at their March and July 1991 meetings to review these sug- gestions.

The primary objective of the March 1991 meeting was the finalization of Fortran 90. With the work of Fortran 90 complete, WC5 was able to place more emphasis on the future of the Fortran Language at the July 1991 meeting. A resolution was adopted at the July meeting establishing a subgroup to develop a management plan and procedures for the future evolution of Fortran standards. The resulting draft plan was balloted by the members prior to the July 1992 meeting. With the results of the ballot available

Elsevier Science B.V. PII SO920-5489(96)0 1007-O

at the July 1992 meeting, WG5 could then finalize this plan and get the process started.

Several resolutions related to the evolution of the Fortran Language were adopted at the July 1992 meeting. Most importantly, the paper, “Strategic Plan for Fortran Standardization,” produced by the subgroup established at the last meeting was adopted as a standing document of the committee after con- sidering the comments from the ballot. An editor was named for the database of functional needs and suggested requirements for future revisions of the Fortran standard. X3J3 was invited to serve as the development body for the near-term revision, which is to be known as Fortran 95.

The Strategic Plan declared the mission of the standardization bodies to be responsive to changing technology and user needs by establishing proce- dures whereby a revision of the International Fortran standard is produced about every five years. After taking nearly three times that long to produce For- tran 90, the five year guideline was well received by the Fortran users on the committee. No longer would they have to wait seemingly forever for new features to appear in the standard. The Strategic Plan also

310 R. Kelhlr/Computer Stundurd.s & Interfuces 18 (1996) 309-314

provided a proposed schedule for the first two revi- sions that are informally known as Fortran 9.5 and Fortran 2000.

Fortran 95 marks the first time that X3J3 was developing a single standard for both the intema- tional community and the US. It primarily will con- tain the corrections and clarifications to Fortran 90. In addition, it will also provide some minor revisions to the language. Fortran 2000 will be a major revi- sion.

2. Gathering requirements

The first step in planning these revisions was to gather requirements. It was clear that due to the limited time for the development of Fortran 95 that the content of that revision would primarily be de- rived from previously submitted requirements. The national standards bodies gathered requirements and forwarded them to WG5 with a recommendation as to which revision should include the resolution of each requirement. Note that this process is still con- tinuing for Fortran 2000 and later revisions.

3. Fortran 95: The first plan

The first plan for Fortran 95 was adopted by WG5 at its July 1993 meeting. That plan specified three categories of requirements:

(a) Those items that were intended to be in For- tran 95;

(b) Those items that were desired to be in Fortran 95; and

(c> Those items that X3J3 was to research (the result of this research to be provided for the August 1994 meeting).

The items intended to be in the Fortran 95 revi- sion were:

0 Corrigenda and modest editorial improvements 0 FORALL statement 0 FORALL construct 0 PURE prefix on functions 0 Add DIM parameter to MAXLOC and MINLOC

intrinsic functions

Those items desired for the Fortran 95 revision were:

0 Object initialization 0 Remove conflicts with IEC 559 (IEEE 754, IEEE

854) l Allocatable components in structures 0 Miscellaneous items 0 Minimal and exact field width editing l Specification of further obsolescent features l Comments in namelist and list-directed input

Finally, those items that X3J3 was to investigate:

CPU-time intrinsic function KIND parameters for derived types Allow some classed of user-defined functions in declarations Support for IEC 559 conforming or similar hard- ware Exception handling Object oriented programming Derived type I/O

One of the underlying principles of this set of features is that the majority of High Performance Fortran (HPF) programs should also be standard conforming Fortran 95 programs with minimal changes. Items 2 through 5 in the first feature list above (those items intended to be in Fortran 95) and item 3 in the third feature list above (those items that X3J3 was to investigate) are a direct result of this principle. Although HPF was primarily designed to allow Fortran programs to execute efficiently on multi-processor systems, the inclusion of these fea- tures in Fortran 95 does not require that a standard conforming processor be a multi-processor.

4. Fortran 95: The second (final) plan

During the X3J3 meetings between the 1993 and the 1994 WG5 summer meetings, X3J3 addressed each of the above items. When it became clear that an item would not be included in the Fortran 95 revision, X3J3 forwarded a paper to WG5 indicating this fact along with the reasons for this recommenda- tion. After its May 1994 meeting, X3J3 forwarded to WG5 the status and recommendations on all of the

R. Kelhle/ Compurrr Srandards & Inrerfuces 18 (19961309-314 311

items in the list. In August 1994, WG5 approved the second and final plan for Fortran 95 as follows:

Corrigenda and modest editorial improvements Add DIM parameter to MAXLOC and MIN- LOC intrinsic functions Comments in namelist input Minimal width editing FORALL statement FORALL construct PURE prefix on functions Object initialization Remove conflicts with IEC 559 (IEEE 754, IEEE 854) CPU-time intrinsic function Nested WHERE (a feature that X3J3 devel- oped which was not on the original list) Allow some classed of user-defined functions in declarations

In addition, X3J3 is to work toward including the following items in the revision:

0 Specification of further obsolescent features 0 ENABLE construct (exception handling) 0 Allocatable arrays as structure components 0 Optional generic-spec on END INTERFACE

X3J3 determined that to complete two of these features, the ENABLE construct and allocatable ar- rays as structure components, would delay Fortran 95. As a result, these features were delayed to For- tran 2000 in order to maintain the schedule.

X3J3 integrated the text implementing these fea- tures into the draft of the Fortran 95 standard that was forwarded to WG5 for the April 1995 meeting. At that meeting, WG5 began processing this draft as the new Fortran standard. At its November 1995 meeting, WG5 reviewed the comments received as a result of a balloting of this draft and forwarded their changes to X3J3 for processing at their November 1995 meeting. X3J3 completed its processing of those comments and prepared the draft international standard that will be balloted within IS0 in early 1996.

5. Fortran 95: The features

The following sections provide a brief description of the features that are expected to be in Fortran 95.

5.1. Extend MAXLOC and MINLOC

Fortran 90 provided six functions of a similar nature, MAXLOC, MINLOC, MAXVAL, MINVAL, SUM, and PRODUCT. Unfortunately, two of them, MAXLOC and MINLOC, did not have one of the arguments, DIM, allowed in the others. Fortran 95 regularizes this group of functions so that they all accept the same arguments. The syntax now is func- tion-name (ARRAY, DIM, MASK) or function-name (ARRAY, MASK, DIM), where function-name is one of the six functions. If the DIM argument were just added to the MAXLOC and MINLOC intrinsic functions, a potential incompatibility with Fortran 90 would exist. Thus the DIM and MASK are permitted to appear in either order.

5.2. NAMELIST comments

This feature allows for trailing commentary on the lines of a NAMELIST input file. The comment is initiated by placing a ! as the first non-blank charac- ter of an input record or following a value separator at the end of an input record.

5.3. Minimalfield width editing

The I, B, 0, Z, and F edit descriptors are ex- tended to allow a field width of zero that requests an implementation to select the smallest field width that will avoid a field overflow.

5.4. FORALL statement and construct

Preliminary versions of Fortran 90 contained an element array assignment statement, the FORALL statement. This feature was removed from the lan- guage prior to the approval of the standard. HPF revived this feature and expanded it to provide both a FORALL statement and a FORALL construct. Both the FORALL statement and the FORALL con- struct from HPF are included in Fortran 95.

312 R. Kelhle / Computer Sramiurds & Interfaces I8 (1996) 309-314

The FORALL construct provides the specification of a single forall-triplet-spec-list and scalar-mask- expr to control multiple assignment statements, masked array assignments (WHERE statements and WHERE constructs), and element array assignments (FORALL statements and FORALL constructs). The FORALL statement is identical to a FORALL con- struct that contains a single forall-body-stmt that is a forall-assignment-stmt. As no order is specified for the evaluation of the forall-triplet-specs, this feature provides an opportunity for multi-processors to par- allelize the assignments. The primary reason for the inclusion of Pure procedures (see below) in Fortran 95 was for use in the forall-assignment-stmts.

The syntax of the Fortran 95 FORALL construct is:

forall-construct 2 [ forall-construct-name: ] FORALL forall-header forall-body-stmt

forall-header

forall-triplet-spec

forall-body-stmt

[ forall-body-stmt 1.. END FORALL [ forall-con- struct-name ]

5 (forall-triplet-spec-list [. scalar- mask-expr 1)

is index-name = subscript - subscript [ : stride ]

is forall-assignment-stmt - or where-stmt - or where-construct Or forall-stmt Or forall-construct

forall-assignment-stmt is Gignment-stmt - or pointer-assignment-stmt

The syntax of the Fort% 95 FORALL statement is:

forall-snnt is FORALLforall-header - forall-assignment-stmt

5.5. WHERE extensions

The WHERE construct of Fortran 90 contained several restrictions. Fortran 95 removes some of these restrictions. In particular, the WHERE con- struct may now be named, ELSEWHERE may now specify a mask, and the WHERE construct may contain nested WHERE statements and constructs. In addition, the assignment statement has been general- ized to allow the new FORALL statement and con- struct. This was done to regularize the language and

to fully integrate the FORALL statement and con- struct.

The syntax of the Fortran 95 WHERE construct is:

where-construct is where construct-stmt - [ where-body-construct I.. [ masked-elsewhere-stmt [ where-body-construct I.. I.. . [ elsewhere-stmt [ where-body-construct I.. I.. . end-where-stmt is [where-construct-name:] -

WHERE (mask-expr) is where-assignment-stmt

or where-stmt G where-construct

iS assignment-stmt - or forall-construct

iS logical-expr is ELSEWHERE (mask-expr) is ELSEWHERE Is END WHERE [ where-con-

struct-name ]

whereconstruct-stmt

where-body-construct

where-assignment-stmt

mask-expr masked-elsewhere-stmt elsewhere-stmt end-where-stmt

5.6. Pure procedures

Pure procedures are procedures without side ef- fects, that is, other than for the dummy arguments of a pure subroutine, the procedure does not change the status of any variable known outside the scope of the procedure. Pure procedures were included primarily for use with the FORALL statement and construct. The syntactic change resulting from this feature is the addition of the PURE keyword as a prefix to the function and subroutine statements.

5.7. Object initialization

Early experience with Fortran 90 uncovered two requirements. Pointers are created with an associa- tion status of undefined. In some cases, it is prefer- able to create a pointer with an association status of disassociated. In addition, it is also desirable to supply default initialization for the nonpointer com- ponents of a derived type. Both of these require- ments are addressed by this feature. With Fortran 95, as part of the declaration of a component of a derived type, an initial value may be supplied for that component.

R. Kelble/Computcr Standards & Interfaces 18 (19961309-314 313

R429 of Fortran 90 was modified as follows:

component-decl is component-name [ ( component-array- - WC ) I

[ * char-length] [ component-initialization ]

Component initialization is specified as:

component-initialization is = initialization-expr iir =) NULL( ) -

5.8. IEEE arithmetic

Fortran 90 contained some perceived conflicts with IEEE arithmetic (the IEC 559 (IEEE 754/854) standard). Fortran 95 removes these perceived con- flicts. In particular, if a processor can distinguish between positive and negative zero and the second argument to the SIGN intrinsic function is a negative zero, the result of the SIGN intrinsic function will differ from that returned by a Fortran 90 processor.

5.9. CPU-time intrinsic function

Fortran 95 includes an intrinsic subroutine, CPU-TIME, that allows the programmer to deter- mine the amount of processor resources consumed during the execution of a program. This subroutine has one argument, TIME, which is set to a proces- sor-dependent approximation to the processor time in seconds.

5.10. User-de$ned function in declarations

HPF specified some functions that could be used as part of a specification expression in the declara- tion of data objects. In order to accommodate this need, it was deemed desirable to allow some form of user-defined functions in declarations. Fortran 95 allows specification functions to appear in specifica- tion expressions in the declaration of data objects. Such a specification expression is considered non- constant. A specification function is a function with several restrictions including that the function must be pure and that it not be internal and not be recursive.

5.1 I. Obsolescent features

As part of the evolution of the Fortran Language, Fortran 90 established the Deleted and Obsolescent

features lists. Fortran 90 did not specify any features on the Deleted features list. In Fortran 95, some of the features contained in the Obsolescent features list of Fortran 90 were moved to the Deleted features list and additional items were added to the Obsolescent features list. The features of Fortran 90 that were are deleted from Fortran 95 are:

0 Real and double precision DO control vari- ables

0 Branching to an END IF statement from out- side its block

0 PAUSE statement 0 ASSIGN and assigned GO TO statements and

assigned format specifiers 0 cH edit descriptor

The features of Fortran 90 that were are added to the Obsolescent features list in Fortran 95 are:

0 Computed GO TO statement 0 Statement functions 0 DATA statements amongst executable state-

ments l Assumed length character functions l Fixed form source 0 CHARACTER* form of CHARACTER dec-

laration

5.12. Optional generic-spec on END INTERFACE

Of the constructs and blocks in the Fortran 90 language, only the interface block did not allow for its name to appear on its END statement. Fortran 95 optionally permits a generic-spec to appear on the END INTERFACE statement when it appears on the INTERFACE statement. R1203 of Fortran 90 was modified as follows:

end-interface-stmt is END INTERFACE - [ generic-spec ]

6. Fortran 95: The approval process

After receiving the draft of Fortran 95 from X3J3 in April 1995, WG5 began the processing of this document as the new Fortran standard. The docu- ment will go through two ballots the first of which will be complete in November 1995 and the second

314 R. Kelhle/Compurer Srnndards & Inserfuces 18 (19961309-314

in September 1996. The expected publication date the language approved approximately every five for Fortran 95 is December 1996. years.

6.1. Fortran 2000: The initial direction 6.3. How you can submit requirements

At its August 1994 meeting, WG5 reaffirmed its intent for Fortran 2000 to be a major revision. The initial direction provided by WGS stated that the highest priority for Fortran in the foreseeable future is to maintain leadership in scientific and engineer- ing computing, where performance is significant; those specific requirements that support this objec- tive are the most important. In addition to putting the final touches to Fortran 9.5 at its November 1995 meeting, WG.5 also adopted the first detailed specifi- cation of the content of Fortran 2000. WG5 also requested further input on requirements so that the content of this revision can be solidified shortly.

You can influence the future direction of the Fortran language by submitting your requirements to your national standards body for forwarding to WG5. X3J3 collects requirements in the US and they are willing to accept requirements from anyone, includ- ing those outside the US. Requirements are sent to the head of the X3J3 Journal of Requirements sub- group. Currently, Stan Whitlock holds this position. Stan can be reached using email on the Internet at [email protected]. If you do not have ac- cess to the Internet, you can send your requirements to Stan via surface mail. Stan’s address is

Stan Whitlock In order to quickly develop enhancements to the

Fortran language, WG5 has begun the process of producing technical reports. These technical reports will contain features that are deemed too important to the Fortran community to be held for the next revision. Note that it is expected that the feature will be incorporated into the next revision exactly as described in the technical report unless experience in either implementation or use of the feature indicates that a change is warranted. Currently, there are three technical reports being developed: 0 Floating point exception handling l Interoperability with C 0 Data type enhancements In addition, as other features of this nature are identified, additional technical reports may be devel- oped.

Digital Equipment Corporation ZK02-3/N30 110 Spit Brook Road Nashua, NH 03062 Note that electronic versions of your requirement

on a floppy are preferred for surface mail. If you have ftp access to the Internet, a number of

X3J3 documents, including one that describes the requirements submission process can be obtained via anonymous ftp from the /x3j3 directory at ftp.ncsa.uiuc.edu. See the file named README for a description of the available files.

6.2. Beyond Fortran 2000

The processes that were developed for the 1995 revision and that are being refined for the 2000 revision are expected to continue, with a revision of

L Richard Kelble ([email protected]) has been involved with the Fortran pro- gramming language since joining Unisys Corporation, in 1977. He was initially a user of the language implementing sim- ulation languages and later financial modeling systems in Fortran. In 1987, he joined the Unisys A Series compiler development group and has spent most of the time since then working on the FORTRAN 77 compiler. He represented Unisys as member of X3J3 from May 1987 to January 1995 serving as secre-

tary from February 1993 to July 1993 and vice chair from July 1993 to January 1995.