Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

ANSI 77 code best procedure to upgrade

zekebryant
Beginner
320 Views

I have old Fortan IV (ANSI 77) code I need to compile with your lastest compiler. Is it possible, and are there special complier switch needed.

or

What is the best procedure, use a specfic converter, complete re-write... etc

0 Kudos
4 Replies
KitturGanesh
Employee
320 Views
Hi

SInce this issue is related to Fortran, I'll take the liberty to move this thread to the Fortran user forum so you can get a proper response there...

thanks,
Kittur
0 Kudos
DavidWhite
Valued Contributor II
320 Views

The issues relating to compiling old code are more to do with obsolete features in the language, and, work arounds that were used at the time, which modern compilers will reject. A simple example was to pass variable size arrays as X(1), and then to access the whole array in a subroutine. Modern compilers will object to this, and you will need to pass the array as X(*).

Other areas to watch for are named COMMON Blocks and whether these have different sizes in different routines.

A summary of the issues relating to modernizing old code can be found at
http://fortranwiki.org/fortran/show/Modernizing+Old+Fortran
Regards,

David

0 Kudos
TimP
Honored Contributor III
320 Views
Quoting David White

The issues relating to compiling old code are more to do with obsolete features in the language, and, work arounds that were used at the time, which modern compilers will reject. A simple example was to pass variable size arrays as X(1), and then to access the whole array in a subroutine. Modern compilers will object to this, and you will need to pass the array as X(*).

Other areas to watch for are named COMMON Blocks and whether these have different sizes in different routines.

David,
You're talking about conversion of pre-f77 code and non-compliant extensions. The question was about f77 code. The notation x(*) for what is now called assumed size was standard in f77, but ifort accepts the common equivalent usage from before f77, without requiring special options.
As you hinted, the usual problems with so-called f77 code involve non-standard extensions, which would be equally troublesome with another f77 compiler.
There aren't compiler switches for all of the (very few) cases of true incompatibility between standards.
ifort attempts to deal with mis-matched common lengths, except for rejecting them under OpenMP.

Opinions vary on the merits of re-writing f77 or f66 code to take advantage of more modern syntax, but such changes should be postponed until the application is working on the new platform.

0 Kudos
Steven_L_Intel1
Employee
320 Views
Most F77 programs will compile and run without problems in Intel Fortran. There are a handful of places where semantics changed in Fortran 90 and later revisions. The /f77rtl option addresses I/O changes, and there are some options under /assume that might be useful, but my recommendation is to just try it and see what happens.
0 Kudos
Reply