Version 8.04B of plusFORT, the premier Fortran refactoring and analysis toolkit has been released. plusFORT is now free for academic and home users working on open source code. A free, fully functional evaluation licence is available for commercial and government users.
plusFORT comprises SPAG, the primary restructuring and reformatting tool, GXCHK for global static analysis, and other tools.
- SPAG reads Fortran code (Fortran 66 up to Fortran 2003, and vendor extensions) and writes a refactored version, ready for immediate input to your compiler.
- SPAG transforms ancient spaghetti code and replaces all GOTOs with modern control structures.
- SPAG rewrites declarations in modern Fortran syntax:-
- Adds explicit type declarations, allowing the use of IMPLICIT NONE.
- Adds INTENT to dummy arguments based on actual usage.
- Convert legacy data types such REAL*8 and INTEGER*4 to standard-conforming modern Fortran (using ISO_FORTRAN_ENV).
- SPAG can implement local conventions and preferences by using indentation, spacing and case in a logical and consistent way.
- SPAG can create modern Fortran modules to replace legacy COMMON blocks and INCLUDE files
- SPAG can create modules containing interface blocks to facilitate compiler argument checking.
- SPAG can identify, and optionally remove unused variables and code fragments.
- SPAG can change variable names in a simple and safe way.
- SPAG can insert probes into your source code to detect “used before set” errors at run-time (including array elements).
- SPAG can insert probes into your source code which time individual subprograms and automatically produce a report when a run completes.
- SPAG can insert probes to identify untested code and computational hot-spots. The results can be inserted, as comments, back into the original code.
- GXCHK performs a global static analysis by combining data produced by SPAG.
- Interact with a sample GXCHK report here.
- GXCHK checks actual arguments and dummy arguments for consistency.
- GXCHK checks for globally unused subprograms, INCLUDE files, COMMON blocks, COMMON variables, MODULE variable, and PARAMETERs.
- GXCHK checks for inconsistent COMMON block definitions.
- GXCHK checks for COMMON or MODULE variables assigned a value but never used, or used but never assigned a value.
- GXCHK checks for COMMON or MODULE variable name in more than one COMMON block or MODULE.
- GXCHK checks for COMMON block or PARAMETER defined in more than one INCLUDE file.
- GXCHK checks for PARAMETER defined with different values in different subprograms.
- GXCHK checks for clashes between names of different types (e.g. local variable the same as COMMON variable).
- GXCHK checks for missing or multiply-defined subprograms.
- GXCHK can analyse the calling and data access patterns in non-modular legacy Fortran code, and produce a design template for conversion to modern Fortran with modules.
More details here.