NAGWare Fortran Tools - f95 Tools - nag_struct95
Index
- NAME
-
- DESCRIPTION
-
- OPTIONS
-
- HANDLING OF SPECIFIC CONSTRUCTS
-
- Arithmetic IF Statements
-
- Assigned GOTO Statements
-
- Comments
-
- Construct Names
-
- Dead Code
-
- LIMITATIONS
-
- SEE ALSO
-
NAME
nag_struct95 - Restructurer
DESCRIPTION
nag_struct95
is the NAGWare f95 Tools restructurer.
Its purpose is to rebuild the flow of control, within
each processed program unit, to a standardised form.
nag_struct95
is based on the structuring algorithm described in
[An Algorithm for Structuring Flowgraphs. Brenda S. Baker [1977].
J. ACM 24, 1 (January 1977), 98-120.].
Unlike the Unix® struct, however, its input and output languages
are the same, that is Fortran 95.
If a filename with no extension is provided the tool will look for a file
with the extension `.f95', and if that does not exist, for a file with
the extension `.f90'.
If a file has the extension `.f90' or `.f95', it will be assumed to
contain free format Fortran code.
If a file has the extension `.f', `.for', `.f77', or `.ftn', the file is
assumed to contain fixed format Fortran code.
The
-fixed
and
-free
options may be used to override this behaviour.
The input file is backed up to
infile.original
and the output file replaces the input file.
Modules (and include files) are expected to exist in the current working
directory or in a directory named by the
-I
option, see
nag_modules95.
OPTIONS
- "Construct Name Prefix" (-construct_name_prefix=prefix)
-
Specifies the prefix to use for generated construct names.
Construct names generated by the tool will consist of the prefix followed by a
number, starting with 1.
The default prefix is ``CONSTRUCT_''.
- "Convert Computed GOTO to SELECT" (-convert_cmgoto_to_select
-no_convert_cmgoto)
-
Enable or disable conversion of computed GOTO statements to
SELECT CASE constructs
- "GOTO start number" (-goto_start_number=N)
-
Specifies the starting label for GOTO statements generated
by the tool (default 6000).
- GOTO step (-goto_step=N)
-
Specifies the increment for successive labels for GOTO
statements generated by the tool (default 10).
- Generate CYCLE statements (-use_cycle_stmts -no_cycle_stmts)
-
Enable or disable generation of CYCLE statements, according to an
heuristic, for branches
that lead to a repetition of a DO loop (default).
- Remove STOP statements (-use_stop_stmts -no_stop_stmts)
-
Enable generation of STOP statements, according to an heuristic, for branches
that terminate the program.
Pre-existing STOP statements are preserved.
If this option is disabled,
in the main program, a pre-existing STOP statement will become a branch to the
END statement, and a "STOP xyz" statement will become a PRINT statement
followed by the branch.
Pre-existing STOP statements in subprograms are unaffected by this option.
General Options
- "Source format" (-fixed, -free)
-
Forces the tool to assume fixed or free format for the
input file. If "Automatic" is set, .f90 files will be
assumed to contain free format code , .f, .for, .f77,
or .ftn are assumed to contain fixed format code.
- "Include and module directories" (-I)
-
Add pathname to the list of directories which are to be searched for
include files. The current working directory is always searched
first, then any directories named in -I options.
- "Fixed format source line length" (-132)
-
Increase the length of each fixed source form input line from 72
characters to 132 characters. This has no effect on free source form
input.
- "Allow double complex specific intrinsics" (-dcfuns)
-
Enable recognition of non-standard double precision complex intrinsic
functions. These act as specific versions of the standard generic intrinsics
as follows:
Non-standard Equivalent Fortran 95 Intrinsic
CDABS(A) ABS(A)
DCMPLX(X,Y) CMPLX(X,Y,KIND=KIND(0d0))
DCONJG(Z) CONJG(Z)
DIMAG(Z) AIMAG(Z)
DREAL(Z) REAL(Z) or DBLE(Z)
- "Downgrade legacy code errors to warning" (-dusty)
-
Allows the analysis of ``legacy'' software by
downgrading the category of common errors found in such software from
``Error'' to ``Warning'' (which may then be suppressed entirely with the
-w option).
- "Suppress information messages" (-info)
-
Suppress output of tool analysis stages information messages.
- "Kind numbers"
-
- "Byte kinds" (-kind=byte)
-
Alter the kind numbering system used so that the kind numbers for
INTEGER, REAL and LOGICAL match the number of bytes of storage
(e.g. default REAL is 4 and DOUBLE PRECISION is 8). Note that COMPLEX
kind numbers are the same as its REAL components, and thus half of the
total byte length in the entity.
- "Sequential kinds" (-kind=sequential)
-
This confirms the default kind numbering system where all datatypes
are numbered sequentially from 1 and increase with precision.
This option does not affect the interpretation of byte-length
specifiers (an extension to Fortran 77).
- "Downgrade argument checks between routines in different files" (-mismatch)
-
Downgrade consistency checking of procedure argument lists so that mismatches
produce warning messages instead of error messages.
This only affects calls to a routine which is not in the current file; calls
to a routine in the file being compiled must still be correct.
- "Downgrade argument checks between routines in the same file" (-mismatch_all)
-
Further downgrade consistency checking of procedure argument lists so that
calls to routines in the same file which are incorrect will produce warnings
instead of error messages.
- "Continuation line limit" (-maxcontin)
-
Increase the limit on the number of continuation lines to N. The
default, as specified by the Fortran standard, is 19 for fixed source
form and 39 for free source form. This will not decrease the limit
below the standard number.
- "Output strict Fortran 95 obsolescent messages" (-strict95)
-
Produce obsolescence warning messages for use of ``CHARACTER*'' syntax.
This message is not produced by default since most programs contain this
syntax.
- "Suppress warning messages" (-w=all)
-
Switch on or off tool analysis stages warning messages.
- "Suppress obsolescent feature warning messages" (-w=obs)
-
Switch on or off warning messages about the use of obsolescent features.
- "Suppress unused entity warning messages" (-w=unused)
-
Suppresses warning messages about unused entities.
It is equivalent to
-w=uda -w=uei -w=ulv -w=usy.
- "Suppress unused dummy argument warning messages" (-w=uda)
-
Switch on or off warning messages about unused dummy arguments.
- "Suppress unused explicit import warning messages" (-w=uei)
-
Switch on or off warning messages about unused explicit imports.
- "Suppress unused local variable warning messages" (-w=ulv)
-
Switch on or off warning messages about unused local variables.
- "Suppress unused symbol warning messages" (-w=usy)
-
Switch on or off warning messages about unused symbols.
- "Suppress Fortran 77 extension warning messages" (-w=x77)
-
Switch on or off extension warnings for common extensions to FORTRAN 77.
These are TAB format, byte-length specifiers and Hollerith constants.
- "Suppress Fortran 95 extension warning messages" (-w=x95)
-
Switch on or off extension warnings for extensions to Fortran 95.
HANDLING OF SPECIFIC CONSTRUCTS
Arithmetic IF Statements
Arithmetic IF statements are converted to ordinary IF statements unless the
three transfer labels are different: in this case the arithmetic IF is left
unchanged.
Assigned GOTO Statements
Assigned GOTO statements are converted either to computed GOTO statements or to
SELECT statements, and the corresponding ASSIGN statements are converted to
assignments.
Comments
Comments are considered to belong to the statement they are either within or
immediately precede.
If that statement is a control-flow statement that is restructured (e.g. a GOTO
statement), the comment will form a statement on its own, as if it were
executable.
Construct Names
The names of block constructs are preserved except for those named block IFs
which become ELSEIF blocks.
The name of a block IF which becomes a DO loop will appear on the block DO.
The tool may generate a construct name for a block DO if that is necessary to
enable use of a CYCLE or EXIT statement (from an inner DO).
Dead Code
Executable statements which follow an unconditional transfer of control are not
reachable.
There is no path to them in the flowgraph and so these statements will be
removed automatically.
A warning message is produced for each dead statement.
Any comments associated with dead code are also deleted.
LIMITATIONS
The tool cannot handle `irreducible' flowgraphs.
An irreducible flowgraph contains a loop which is entered in two different
places.
Such loops cannot be DO loops.
A subprogram with an irreducible flowgraph is output with no change to the
original structure other than the conversion of assigned GOTO statements to
computed GOTO statements, and arithmetic IF statements to logical IF
statements.
BLOCK DATA subprograms contain no executable code and so are output unchanged.
SEE ALSO
nag_polopt95,
nag_struct.
Copyright, Numerical Algorithms Group, Oxford, 1997-2001