Fortran is out of date

Changeover from FORTRAN 77 to Fortran 90/95


The current international standard for the Fortran language is Fortran 95. The next international Fortran standard, Fortran 2000, is being worked on intensively. Nevertheless, there are still Fortran programmers who have not yet made the first step from FORTRAN 77 to Fortran 90, and there are still extensive FORTRAN77 program packages that are maintained with ancient FORTRAN77 compilers.

Not only because these old compilers are slowly becoming extinct, but also because of the year 2000 problem, the time is getting closer and closer when these old programs have to be converted to new compilers and to a modern language level.

The programmer problem

There are very good online tutorials for Fortran programmers who are not yet familiar with the use of Fortran 90. For example, the first part of "High Performance Fortran Programming" is particularly useful for programmers who are not only interested in Fortran 90, but later also in the data-parallel programming of parallel computers. And "Fortran 90 for the Fortran 77 Programmer" is suitable for programmers who are specifically interested in the transition from FORTRAN 77 to Fortran 90.

For programmers who do not have the problem of converting old FORTRAN77 programs, but who want to refresh their Fortran knowledge, it is advisable to cut off all old braids and turn to the F programming language. The programming language F is like Fortran 90 without (the outdated, redundant and error-prone language elements of) FORTRAN 77.

The compiler problem

In connection with the changeover to modern Fortran, the question of which type of computer (mainframe, workstation or PC) the Fortran programs should be calculated on in the future has to be clarified. There is a whole range of compilers to choose from for workstations or PCs.

The RRZN offers members of the UH free of charge Fortran90 and Fortran95 compilers from NAGWare for installation on the institute's own workstations.

For many old mainframe Fortran programs there is even the option of switching from the mainframe to the PC because of the enormously increased performance of the PCs. Under Windows 95 or Windows NT there are a number of useful to good compilers for PCs. The members of the UH can get the Fortran90 compiler from NAGWare / Salford free of charge for installation on the institute's Windows PCs from the RRZN.

For Intel PCs under Linux, there are also a number of free compilers in addition to a number of chargeable compilers. For members of the UH the RRZN offers a Fortran90 compiler and a Fortran95 compiler from NAGWare free of charge for installation on the institute's own Linux PCs. In addition, there is a Fortran90 compiler from Pacific-Sierra Research (PSR), which is free for non-commercial use and which can also be installed at home outside the university. In terms of compilation times and execution times, this compiler is significantly more efficient than the above-mentioned compilers for PCs under Windows 95 / NT. And with the exception of recursive subroutines, it is as powerful as the NAGWare compilers for Linux PCs.

Because Fortran 95 differs very little from Fortran 90, and because Fortran95 compilers accept Fortran90 programs, it does not matter whether you want to use a Fortran90 compiler or a Fortran95 compiler to convert old FORTRAN77 programs. The changeover to Fortran 90 is almost always also a changeover to Fortran 95.

The program migration problem

The actual program changeover to the new compiler should be as simple as possible. The amount of effort you want to make also depends on how standard the program should then be.
  • Option 1: You use a compiler that knows as many of the old, computer-dependent language extensions as possible that your old FORTRAN77 program uses. Some of the Windows PC compilers mentioned above support this strategy. The remaining non-standardized language resources have to be modified manually.
  • Option 2: You use a tool that brings your program into the new form and modifies it moderately so that you can at least recognize it afterwards.
  • Possibility 3. You use a tool that brings your program into the new form and at the same time restructures it.
  • Option 4: You first use tools for program analysis and, if necessary, modify the original program, which is then more or less automatically brought into the new form and restructured at the same time.

The first option is possibly the quickest way to achieve the goal. In fact, this only ensures that a FORTRAN77 program runs on a Fortran90/95 system. It remains a FORTRAN77 program in character. And the real migration problems are only postponed until later. The fourth option is the safest way to proceed in the long run.

For the simple conversion from the old source text form to the new form, one can use e.g. the auxiliary programs or. These (Fortran90) programs are freely available to all users. For RRZN users we have installed the program on the Sun workstations of the RRZN. not only converts your FORTRAN77 program into the new source text form, but it can also carry out a restructuring of your program to a certain extent. For non-commercial use on Linux PCs there is a free version of; this is a whole toolbox for the analysis and restructuring of FORTRAN77 programs. The final automatic conversion of the FORTRAN77 program into the new Fortran90 form is unfortunately not supported by the free version, but only by the commercial version. also handles many of the common language extensions (from DEC VAX Fortran, from IBM VS Fortran and the most popular compilers for workstations and PCs).

If you want to be sure that the converted program is really a modern Fortran program that is free of outdated, redundant and error-prone FORTRAN77 language elements, then you should submit it to an F compiler for analysis. There are even professional free F-compilers for a whole range of computing environments.

Résumé

The use of tools for analyzing old FORTRAN77 programs and for converting them into modern Fortran90 programs is very helpful. It is often possible to convert FORTRAN77 language extensions into standard-compliant Fortran.

Despite the use of tools, more or less extensive manual interventions are required to convert non-standardized FORTRAN77 language elements into standardized Fortran. Problems arise regularly if hardware-related language elements are used in the old program (e.g. address arithmetic, screen control, etc.) or if tricks are used (e.g. exploiting the peculiarities of the parameter transfer of the compiler used) or if operating system properties are exploited (e.g. peculiarities the memory management, the loader, the handling of commands, etc.).

When converting old FORTRAN77 programs to executable or even modern Fortran90/95 programs, there is no guarantee that the use of a compiler within a development environment with a graphical user interface and integrated tools is more efficient and successful than the use of a Linux compiler at the command level from the command prompt.

When converting various old benchmark programs, some of which are very extensive, for testing many different compilers for mainframe computers, Intel PCs and workstations, I have the fewest difficulties and the fastest success clearly when using the new free Linux compiler (see above) from PSR had. As a pleasant side effect it turned out that the compiler was almost always more efficient in every respect compared to all other tested compilers for Intel PCs.


Jun 15, 1998 Wilhelm Gehrke [email protected]