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

Are the Fortran 90 features safe in a FORTRAN 77 code?

woshiwuxin
Novice
865 Views
Hi,
I have a legacy FORTRAN 77 code (*.f). I want to use some Fortran 90 features in it, e.g. module and dynamic memory allocation. Because it's too big to re-write everything in the standard Fortran 90 (*.f90), I'm wondering is it safe to incorporate the Fortran 90 features in a FORTRAN 77 code (*.f). For example,
[fxfortran]       use global
       real(kind=8), allocatable :: a(:)
       allocate(a(10))
[/fxfortran]
I clearly understand that this is the compiler dependent. Since I'm always using Intel Fortran Compiler (my signature), I want to ask the experts in Intel. I have tried some by using ifort, it works fine. But I'm not 100 percent sure about it.
Thanks!
0 Kudos
3 Replies
TimP
Honored Contributor III
865 Views
Maybe your concern is about compiler dependence.
real(kind=8) may be the most questionable. It's fairly safe to expect it to continue working with the successors of compilers for which it works now. People who use that usually call real*8 fortran 77, even though it isn't. If you search, you will find 1 or 2 currently maintained compilers where one or more of real*8 or real(8) doesn't work, where real(selected_real_kind(12)) does.
I suppose any compiler would correct you on the spelling of deallocate.
All such basic f90 features have been supported by every maintained compiler for at least 5 years. If the application works OK with a current compiler before you make f90 modifications, it should be entirely feasible to make changes incrementally while testing.
0 Kudos
woshiwuxin
Novice
865 Views
Thanks, Tim!
0 Kudos
Steven_L_Intel1
Employee
865 Views
I think you have a common misconception - just because a file has a .f file type, that doesn't mean it is "FORTRAN 77 code". Fixed-form source is still standard in Fortran 2008, though it is deprecated. There is no problem using any standard feature in fixed-form source.
0 Kudos
Reply