How to identify fortran standard - '77, '90, or '95?

There probably are automated tools, but my methods are largely heuristic:

  • Do comments use a ! anywhere on the line (F90+) or a C in the first column (F77)?
  • Do loops use do..end do (F90+) or do..continue (F77)?
  • Are lines continued using & at the end of the line (F90+) or in column 6 (f77)?
  • Does the code use module or type structures (F90)?
  • If the code uses arrays, does it operate on them as a single structure (F90) or always using loops (F77)?
  • Is dynamic memory (either using allocatable or pointer methods) used (F90)?

Generally these are enough to discriminate between F90 and F77. The differences between Fortran 90 and FORTRAN 77 are much, much larger than the differences between Fortran 90 and Fortran 95 so I usually stop there.


I'm adding features in fortran 2003 and 2008 (which are just back of my head)

if the program has parameterized-derived datatypes (fortran 2003.) if the array constructor uses square brackets [ ] instead of (/ /) (fortran 2003.) if you see,there is provision of using coarrays (fortran 2008)

although many compilers have special functions(like Bessel functions) as part of extensions , it is a bonafide fortran 2008 feature.

(if any discrepancies let me know i'll edit)


If you have access to GNU Fortran (gfortran) you can try compiling it with the different options for --std and see which one works. You can find details on the dialect options here.

Tags:

Fortran