NAGWare f95 Compiler Release 5.1

Contents

Name

f95 - Fortran 95 compiler Release 5.1

Usage

f95 [option]... file...

Description

f95 is the NAGWare Fortran 95 compiler. It translates programs written in Fortran 77, Fortran 90 or Fortran 95 into executable programs, relocatable binary modules, assembler source files or C source files.

The suffix of a filename determines the action f95 performs upon it. Files ending in .f90 or .f95 are taken to be Fortran 90/95 free form source files, files ending in .f, .for or .ftn are taken to be Fortran 90/95 fixed form (or Fortran 77) source files. On Unix, files ending in .F90 or .F95 are taken to be free source form files requiring preprocessing by fpp, files ending in .F are taken to be fixed source form files requiring preprocessing by fpp. On MacOS/X and Windows files ending in .ff90 or .ff95 are taken to be free source form files requiring preprocessing by fpp, files ending in .ff are taken to be fixed source form files requiring preprocessing by fpp. (Note that on MacOS/X and Windows, the file system is not case-sensitive so uppercase and lowercase letters are equivalent in filenames including in the suffixes.)

If a filename without a suffix is provided f95 will look for a file with the suffix .f95, and if that does not exist, the suffix .f90.

Modules and include files are expected to exist in the current working directory or in a directory named by the -I option.

Options not recognised by f95 are passed to the link phase (cc or gcc).

Options

-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.
-abi=abi
(SG/Irix 6 only) Specify the ABI to compile for, either 32 (the old 32-bit ABI), n32 (the new 32-bit ABI) or 64 (the 64-bit ABI). Programs compiled with -abi=64 will only run on 64-bit kernels. Programs compiled with -abi=n32 will run on any Irix 6 system.

The default is -abi=32 if -target=mips1 or -target=mips2 has been specified, -abi=64 on 64 bit kernels, and -abi=n32 on 32-bit kernels.

-abi=abi
(AMD64 only) Specify the ABI to compile for, either 32 (the 32-bit ABI), or 64 (the AMD 64-bit ABI). Programs compiled with -abi=64 will only run on 64-bit kernels. Programs compiled with -abi=32 will run on any Linux system. The default is -abi=64.
-align=alignment
(MacOS/X only) Specify the alignment of variables and components, which must be one of:
natural
(natural alignment for best performance; this can alter the interpretation of COMMON block or SEQUENCE type layout in a non-standard-conforming manner), or
standard
(use standard-conforming alignment; this is the default).
The whole program should be compiled with the same alignment option.
-Bbinding
Specify static or dynamic binding. This only has effect if specified during the link phase. The default is dynamic binding.
-c
Compile only (produce .o file for each source file), do not link the .o files to produce an executable file.
-C
Compile code with all but the most expensive runtime checks. This omits -C=dangling and -C=undefined.
-C=check
Compile checking code according to the value of check, which must be one of:
all
(perform all checks except for -C=undefined),
array
(check array bounds),
bits
(check bit intrinsic arguments),
calls
(check procedure references),
dangling
(check for dangling pointers),
do
(check DO loops for zero step values),
none
(do no checking: this is the default),
present
(check OPTIONAL references),
pointer
(check POINTER references),
recursion
(check for invalid recursion),
scale
(check for scale factor followed by repeat count) or
undefined
(check for undefined variables; see later section for details).
-colour
Colour the message output from the compiler using ANSI escape sequences and the default foreground colouring scheme which is: red for error messages (including fatal errors), blue for warning messages and green for information messages.
-colour=scheme
Colour the message output from the compiler according to the specified scheme. This is a comma-separated list of colour specifications, each consisting of a message category name ("error", "warn" or "info") followed by a colon and the foreground colour name, optionally following by a plus sign and the background colour name. The colouring for unspecified categories will be the default.

Colours are: black, red, green, yellow, blue, magenta, cyan and white.

E.g. -colour=error:red+blue,warn:cyan,info:magenta+yellow
would be a rather garish colour scheme.

-Dname
Defines name to fpp as a preprocessor variable. This only affects files that are being preprocessed by fpp.
-dcfuns
Enable recognition of non-standard double precision complex intrinsic functions. These act as specific versions of the standard generic intrinsics as follows:
Specific Equivalent Fortran 90/95 Generic Intrinsic Function
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)
-double
Double the size of default INTEGER, LOGICAL, REAL and COMPLEX. Entities specified with explicit kind numbers or byte lengths are unaffected. If quadruple precision REAL is available, the size of DOUBLE PRECISION is also doubled.
-dryrun
Show but do not execute commands constructed by the compiler driver.
-dusty
Allows the compilation and execution 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). This option disables -C=calls, and also enables Hollerith i/o (see the -hollerith_io option).
-F
Preprocess only, do not compile. Each file that is preprocessed will produce an output file of the same name with the suffix replaced by .f, .f90 or .f95 according to the suffix of the input file.
-f77
Make external linkages compatible with the native f77 compiler where possible. On AIX, HP-UX and Windows, this suppresses the trailing underscore for those external names that do not clash with C language keywords or library functions.
-f2003
Specify that the base language is Fortran 2003. (The default in this release is Fortran 95.) This only affects extension message generation (Fortran 2003 features will not be reported as extensions).
-f90_sign
Use the Fortran 77/90 version of the SIGN intrinsic instead of the Fortran 95 one (they differ in the treatment of negative zero).
-f95
Specify that the base language is Fortran 95. (This is the default in this release.) This only affects extension message generation (Fortran 2003 features will be reported as extensions).
-fixed
Interpret all Fortran source files according to fixed-form rules.
-float-store
(Gnu C based systems only) Do not store floating-point variables in registers on machines with floating-point registers wider than 64 bits. This can avoid problems with excess precision.
-fpp
Preprocess the source files using fpp even if the suffix would normally indicate an ordinary Fortran source file.
-framework f
(MacOS/X only) Use framework f during linking.
-free
Interpret all Fortran source files according to free-form rules.
-g
Produce information for interactive debugging by the host system debugger.
-g90
Compile and link for debugging by dbx90, the Fortran 90 aware front-end to dbx. This produces a debug information (.g90) file for each Fortran source file. This option must be specified for compilation and linking.
-gc
Enables automatic garbage collection of the executable program. This option must be specified for both compilation and linking, and is incompatible with -thread_safe and -mtrace.
-gline
Compile code to produce a traceback when a runtime error message is generated. Only routines compiled with this option will appear in such a traceback. This option increases both executable file size and execution time. Example:
      Invalid character in real input field
      Program terminated by fatal I/O error
      In  READ_COORDS, line 27 of readfile.f90
      Called by READ_DATA, line 111 of data.f90
      Called by INITIAL, line 44 of main.f
      Called by $MAIN$, line 13 of main.f
-help
Display a one-line summary of each option.
-hollerith_io
Enable Fortran-66 compatible input/output of character data stored in numeric variables using the A edit descriptor. This was superseded by the CHARACTER datatype in Fortran 77.
-hpf
Accept the extensions to Fortran specified by the High Performance Fortran Forum in HPF 1.0. These consist of the EXTRINSIC keyword and a large number of compiler directives. The compiler directives are checked for correctness but have no effect on compilation.
-I pathname
Add pathname to the list of directories which are to be searched for module information (.mod) files and INCLUDE files. The current working directory is always searched first, then any directories named in -I options, then the compiler's library directory (usually /usr/local/lib/NAGWare or /opt/NAGWare/lib).
-ieee=mode
Set the mode of IEEE arithmetic operation according to mode, which must be one of full, nonstd or stop.
-ieee=full
enables all IEEE arithmetic facilities including non-stop arithmetic.
-ieee=nonstd
disables IEEE gradual underflow, producing zero instead of a denormalised number; the resulting program may run faster. Non-stop arithmetic is also disabled, terminating execution on floating overflow, divide by zero or invalid operand.
-ieee=stop
enables all IEEE arithmetic facilities except for non-stop arithmetic; execution will be terminated on floating overflow, divide by zero or invalid operand.

On DEC Alpha running Digital UNIX, the -ieee option must be specified when compiling all program units. On other machines and operating systems, the -ieee option must be specified when compiling the main program unit, and its effect is global. The default mode is -ieee=stop.

-info
Request output of information messages. The default is to suppress these messages.
-kind=option
Specify the kind numbering system to be used; option must be one of byte or sequential.

For -kind=byte, the kind numbers for INTEGER, REAL and LOGICAL will 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.

For -kind=sequential (the default), the kind numbers for all datatypes are numbered sequentially from 1, increasing with precision (e.g., default REAL is 1 and DOUBLE PRECISION is 2).

This option does not affect the interpretation of byte-length specifiers (an extension to Fortran 77).

-lx
Link with library libx.a. The linker will search for this library in the directories specified by -Ldir options followed by the normal system directories (see the ld(1) command).
-Ldir
Add dir to the list of directories for library files (see the ld(1) command).
-M
Produce module information files (.mod files) only.
-maxcontin=N
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 option will not decrease the limit below the standard number.
-mdir dir
Write any module information (.mod) files to directory dir instead of the current working directory.
-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. This option disables -C=calls.
-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. This option disables -C=calls.
-mtrace
Trace memory allocation and deallocation. This option is a synonym for -mtrace=on.
-mtrace=trace_opt_list
Trace memory allocation and deallocation according to the value of trace_opt_list, which must be a comma separated list of one or more of:
address
(display addresses),
all
(all options except for off),
line
(display file/line info if known),
off
(disable tracing output),
on
(enable tracing output),
paranoia
(protect memory allocator data structures against the user program),
size
(display size in bytes) or
verbose
(all options except for off and paranoia).

This option should be specified during both compilation and linking, and is incompatible with the -gc option.

-nan
Initialise REAL and COMPLEX variables to IEEE Signalling NaN, causing a runtime crash if the values are used before being set. This affects local variables, module variables, and INTENT(OUT) dummy arguments only; it does not affect variables in COMMON or EQUIVALENCE.
-nocheck_modtime
Do not check for .mod files being out of date.
-nomod
Suppress module information (.mod) file production.
-noqueue
If no licence for the compiler is immediately available, exit with an error instead of queueing for it.
-o output
Name the output file output instead of the default. If an executable is being produced the default is a.out; otherwise it is file.o with the -c option, file.c with the -S option, and file.f, file.f90 or file.f95 with the -F option, where file is the base part of the source file (i.e. with the suffix removed).
-O
Normal optimisation, equivalent to -O2.
-ON
Set the optimisation level to N. The optimisation levels are:
-O0
No optimisation. This is the default, and is recommended when debugging.
-O1
Minimal quick optimisation.
-O2
Normal optimisation.
-O3
Further optimisation.
-O4
Maximal optimisation.
-Oassumed
This is a synonym for -Oassumed=contig.
-Oassumed=shape
Optimises assumed-shape array dummy arguments according to the value of shape, which must be one of
always_contig
Optimised for contiguous actual arguments. If the actual argument is not contiguous a runtime error will occur (the compiler is not standard-conforming under this option).
contig
Optimised for contiguous actual arguments; if the actual argument is not contiguous (i.e. it is an array section) a contiguous local copy is made. This may speed up array section accessing if a sufficiently large number of array element or array operations is performed (i.e. if the cost of making the local copy is less than the overhead of discontiguous array accesses), but usually makes such accesses slower. Note that this option does not affect dummy arguments with the TARGET attribute; these are always accessed via the dope vector.
section
Optimised for low-moderate accesses to array section (discontiguous) actual arguments. This is the default.

Note that CHARACTER arrays are not affected by these options.

-Oblock=N
Specify the dimension of the blocks used for evaluating the MATMUL intrinsic. The default value (only for -O1 and above) is system and datatype dependent.
-Onopropagate
Disable the optimisation of constant propagation. This is the default at optimisation levels of 1 or lower.
-Opropagate
Enable the optimisation of constant propagation. This is the default at optimisation levels of 2 or higher.
-Orounding
Specify that the program does not alter the default rounding mode. This enables the use of faster code for the ANINT intrinsic.
-Ounroll=N
Specify the depth to which simple loops and array operations should be unrolled. The default is no unrolling (i.e. a depth of 1) for -O0 and -O1, and a depth of 2 for -O and higher optimisation levels. It can be advantageous to disable f95's loop unrolling if the C compiler normally does a very good job itself - this can be accomplished with -Ounroll=1.
-Ounsafe
Perform possibly unsafe optimisations that may depend on the numerical stability of the program.
-pg
Compile code to generate profiling information which is written at run-time to an implementation-dependent file (usually gmon.out or mon.out). An execution profile may then be generated using gprof. This option must be specified for compilation and linking and may be unavailable on some implementations.
-pic
Produce position-independent code (small model), for use in a shared library. If the shared library is too big for the small model, use -PIC.
-PIC
Produce position-independent code (large model), for use in a shared library.
-Qpath pathname
Change the f95 compiler library pathname from the default (usually /usr/local/lib/NAGWare or /opt/NAGWare/lib) to pathname.
-r8
Double the size of default REAL/COMPLEX, and on machines for which quadruple-precision REAL/COMPLEX are available, double the size of DOUBLE PRECISION. REAL/COMPLEX specified with explicit KIND numbers or byte lengths are unaffected - but since the KIND intrinsic returns the correct values, COMPLEX(KIND(0d0)) on a machine with quad-precision floating-point will correctly select quad-precision COMPLEX.

This has no effect on INTEGER sizes, and so the compiler is not standard-conforming in this mode.

Note: This option has been superseded by the -double option which doubles the size of all numeric data types.

-s
Strip symbol table information from the executable file. This option is passed to ld so only has effect during the link phase.
-S
Produce assembler (actually C source code). The resulting .c file should be compiled with the f95 command, not with the C compiler directly.
-save
This is equivalent to inserting the SAVE statement in all subprograms which are not declared RECURSIVE, thus causing all local variables in such subprograms to be statically allocated.
-strict95
Produce obsolescence warning messages for use of "CHARACTER*" syntax. This message is not produced by default since most programs contain this syntax.
-target=machine
Specify the machine for which code should be generated and optimised.

For gcc on Sun/SPARC, machine may be one of

V7
SPARCstation 1 et al,
V8
SPARCstation 2 et al,
super
SuperSPARC,
ultra
UltraSPARC or

The default is to compile for SPARC V7.

Note that programs compiled for later versions of the architecture may not run, or may run much more slowly, on an earlier machine.

For Sun/SPARC, machine may be one of

V7
SPARCstation 1 et al,
V8
SPARCstation 2 et al,
super
SuperSPARC,
ultra
UltraSPARC or
native
the current machine.

The default is to compile for SPARC V7.

Note that programs compiled for later versions of the architecture may not run, or may run much more slowly, on an earlier machine. The -target=super and -target=ultra options do not work with Sun C prior to SC4.0. The -target=native option is not available with GCC.

For Digital Alpha Unix, machine may be one of

ev4, ev5, ev56, pca56
the specified evolution of the Alpha chip
native
the current machine.

For HP9000/700, machine may be one of

2.0
the specified revision of the PA-RISC architecture (default)
native
the current machine.

For FreeBSD 5 and Intel Linux (RedHat 9), machine may be one of

i486, i586, i686, pentium2, pentium3, pentium4
the specified Intel processor,
k6, k6-2, k6-4, athlon, athlon-tbird, athlon-4, athlon-xp, athlon-mp
the specified AMD processor,
pentium
(equivalent to i586) or
pentiumpro
(equivalent to i686).

The default is to compile for i486. On Linux RedHat 9 and FreeBSD 5 additional machine specifications may be used: pentium2, pentium3, pentium4, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp and athlon-mp.

For SG/Irix 6, machine may be one of

mips1
R2000/R3000. Incompatible with -abi=n32 and -abi=64.
mips2
R4000 or later. Code thus produced will not run on R2000/R3000-based machines. Incompatible with -abi=n32 and -abi=64.
mips3
R4000 or later. Incompatible with -abi=32.
mips3,processor
Same as -target=mips3, with optimisations specific to processor, which may be R5000, R8000 or R10000. Incompatible with -abi=32.
mips4
R5000/R8000/R10000.
mips4,processor
Same as -target=mips4, with optimisations specific to processor.
native
Use -target=mips4 on an R5000/R8000/R10000 processor with appropriate optimisations, and -target=mips3 otherwise. Incompatible with -abi=32.

The default with -abi=32 is -target=mips1, with -abi=n32 is -target=mips3 and with -abi=64 is -target=mips4.

-tempdir directory
Set the directory used for temporary files to directory. The default is to use the directory named by the TMPDIR environment variable, or if that is not set, /tmp.
-thread_safe
Compile code for safe execution in a multi-threaded environment. This must be specified when compiling and also during the link phase. It is incompatible with -gc.
-time
Report execution times for the various compilation phases.
-u
Specify that IMPLICIT NONE is in effect by default, unless overridden by explicit IMPLICIT statements.
-unsharedf95
Bind with the unshared (static) version of the f95 runtime library; this allows a dynamically linked executable to be run on systems where the NAGWare f95 compiler is not installed. This option is only effective if specified during the link phase.
-v
Verbose. Print the name of each file as it is compiled.
-V
Print version information about the compiler.
-w
Suppress all warning messages. This option is a synonym for -w=all.
-w=class
Suppress the warning messages specified by class, which must be one of all, alloctr, obs, uda, uei, uep, uip, ulv, unused, usf, usy, x77 or x95.
-w=all
suppresses all warning messages.
-w=alloctr
suppresses warning messages about the use of allocatable components, dummy arguments and functions.
-w=obs
suppresses warning messages about the use of obsolescent features.
-w=uda
suppresses warning messages about unused dummy arguments.
-w=uei
suppresses warning messages about unused explicit imports.
-w=uep
suppresses warning messages about unused external procedures.
-w=uip
suppresses warning messages about unused intrinsic procedures.
-w=ulv
suppresses warning messages about unused local variables.
-w=unused
suppresses warning messages about unused entities. It is equivalent to "-w=uda -w=uei -w=uep -w=uip -w=ulv -w=usf -w=usy".
-w=usf
suppresses warning messages about unused statement functions.
-w=usy
suppresses warning messages about unused symbols.
-w=x77
suppresses extension warnings for common extensions to Fortran 77. These are TAB format, byte-length specifiers and Hollerith constants.
-w=x95
suppresses extension warnings for extensions to Fortran 95.
-Woptions
The -W option can be used to specify the path to use for a compilation component or to pass an option directly to such a component. The possible combinations are:
-W0=path
Specify the path used for the Fortran 95 front-end. Note that this does not affect the library directory; the -Qpath option should be used to specify that.
-Wc=path
Specify the path to use for invoking the C compiler; this is used both for the final stage of compilation and for linking.
-Wc,option
Pass option directly to the host C compiler when compiling (producing the .o file). Multiple options may be specified in a single -Wc, option by separating them with commas.
-Wl=path
Specify the path to use for invoking the linker (producing the executable).
-Wl,option
Pass option directly to the host C compiler when linking (producing the executable). Multiple options may be specified in a single -Wl, option by separating them with commas.
-Wp=path
Specify the path to use for invoking the fpp preprocessor.
-Wp,option
Pass option directly to fpp when preprocessing.
-wmismatch=proc-name-list
Specify a list of external procedures for which to suppress argument data type and arrayness consistency checking. The procedure names should be separated by commas, e.g. -wmismatch=proc_one,p2. Unlike the -mismatch option, this only affects data type and arrayness checking, and no warning messages are produced.
-xs
(Sun/SPARC option only) Store the symbol tables in the executable (otherwise debugging is only possible if the object files are kept).

Files

file.a
Library of object files
file.c
C source file
file.f
Fixed-form Fortran 90/95 or FORTRAN 77 source file
file.f90
Free-form Fortran 90/95 source file
file.f95
Free-form Fortran 90/95 source file
file.ff
(MacOS/X and Windows) Fixed-form Fortran 90/95 or FORTRAN 77 preprocessor file.
file.F
(Unix) Fixed-form Fortran 90/95 or FORTRAN 77 preprocessor file.
file.ff90
(MacOS/X and Windows) Free-form Fortran 90/95 preprocessor file.
file.F90
(Unix) Free-form Fortran 90/95 preprocessor file.
file.ff95
(MacOS/X and Windows) Free-form Fortran 90/95 preprocessor file.
file.F95
(Unix) Free-form Fortran 90/95 preprocessor file.
module_name.mod
Compiled module information file
file.o
Object file
/opt/NAGWare/lib
NAGWare library directory on Sun Solaris (may be changed by -Qpath); referred to as library hereafter.
/usr/local/lib/NAGWare
NAGWare library directory on other machines and operating systems.
library/f95mcheck.f90
Source code for the f95mcheck program.
library/f90_util.f90
A sample Fortran 90 program that displays implementation-specific information

Compilation Messages

The messages produced by f95 itself during compilation are intended to be self-explanatory. The linker, or more rarely the host C compiler, may produce occasional messages.

Messages produced by the compiler are classified by severity level; these levels are:

Info
informational message, noting an aspect of the source code in which the user may be interested.
Warning
some questionable usage has been found in the user's code which may indicate a programming error.
Extension
some non-standard-conforming code has been detected but has successfully been compiled as an extension to the language. This has the same severity as "warning".
Obsolescent
some archaic code has been detected which although standard-conforming was classified as obsolescent by the Fortran 95 standard. This has the same severity as "warning".
Deleted feature used
a feature that was present in Fortran 90 but deleted from the Fortran 95 standard was used. This has the same severity as "warning".
Error
the source code does not conform to the Fortran standard or does not make sense. Compilation continues after recovery.
Fatal
a serious error in the user's program from which the compiler cannot recover, the compilation is immediately terminated.
Panic
an internal inconsistency is found by one of the compiler's self-checks; this is a bug in the compiler itself and NAG should be notified.

Compiler Limits

Maximum INCLUDE file nesting = 20
Maximm number of INCLUDE file references per compilation = 2047
Maximum DO loop nesting level = 199
Maximum CASE construct nesting level = 30
Maximum DATA-implied-DO loop nesting = 20
Maximum array-constructor-implied-DO loop nesting = 20
Maximum number of dummy arguments = 32767
Maximum number of arguments to MIN and MAX = 20
Maximum character length or array size = 2147483647
Maximum unit number = 2147483647
Maximum I/O record length = 2147483647

Input/Output Information

Standard error (stderr) unit number = 0
Standard input (stdin) unit number = 5
Standard output (stdout) unit number = 6
Default maximum record length for formatted output = 1024 characters
Default maximum record length for unformatted output = 2147483647 bytes

The default directory used for files opened with STATUS='SCRATCH' is "/tmp" on Unix and "c:/temp" on Windows. This default may be overridden with the TMPDIR environment variable.

Automatic File Preconnection

All logical unit numbers are automatically preconnected to specific files. These files need not exist and will only be opened or created if they are accessed with READ or WRITE without an explicit OPEN. By default the specific filename for unit n is fort.n; however if the environment variable FORTnn exists its value is used as the filename. Note that there are two digits in this variable name, e.g. the variable controlling unit 1 is FORT01 whereas the default filename is "fort.1" (unless the prefix has been changed, see the description of module F90_PRECONN_IO.

A file preconnected in this manner is opened with ACCESS='SEQUENTIAL'. If the initial READ or WRITE is an unformatted i/o statement, it is opened with FORM='UNFORMATTED' otherwise it is opened with FORM='FORMATTED'. By default (see module F90_PRECONN_IO) a formatted connection is opened with BLANK='NULL' and POSITION='REWIND'.

Automatic preconnection applies only to the initial use of a logical unit; once CLOSEd the unit will not be reconnected automatically but must be explicitly OPENed.

Note that this facility means that it is possible for a READ or WRITE statement with an IOSTAT= clause to receive an i/o error code associated with the implicit OPEN.

IEEE 754 Arithmetic Support

If no floating-point option is specified, any floating divide-by-zero, overflow or invalid operand exception will cause the execution of the program to be terminated (with an informative message and usually a core dump). Occurrence of floating underflow may be reported on normal termination of the program. On hardware supporting IEEE 754 standard arithmetic gradual underflow with denormalised numbers will be enabled. Note that this mode of operation is the only one available on hardware which does not support IEEE 754.

If the -ieee=full option is specified, non-stop arithmetic is enabled; thus REAL variables may take on the values +Infinity, -Infinity and NaN (Not-a-Number). If any of the floating exceptions listed above are detected by the hardware during execution, this fact will be reported on normal termination. The -ieee=full option must be specified when compiling the main program and has global effect; that is, it affects the entire executable program (except on DEC Alpha; see below).

If the -ieee=nonstd option is specified, floating-point exceptions are handled in the default manner (i.e. execution is terminated). However, gradual underflow is not enabled, so results which would have produced a denormalised number produce zero instead. This option can only be used on hardware for which this mode of operation is faster. Like -ieee=full, the -ieee=nonstd option must be specified when compiling the main program and has global effect (except on DEC Alpha).

On Digital UNIX (DEC Alpha), all -ieee= options only work fully if used for compiling all program units; this is because on the Alpha architecture different (slower) code must be generated for arithmetic which is capable of producing denormalised numbers.

Random Number Algorithm

The random number generator supplied as the intrinsic subroutine RANDOM_NUMBER is the "good, minimal standard" generator described in "Random Number Generators: Good Ones Are Hard to Find" [CACM October 1988, Volume 31 Number 10, pp 1192-1201]. This is a parametric multiplicative linear congruential algorithm with the following parameters:

modulus: 2**31-1 (2147483647)

multiplier: 16807

This is a full-period generator. The seed is obtained from the time-of-day clock; viz time*16807+1 where "time" is the number of seconds past midnight.

Automatic Garbage Collection

The -gc option enables use of the runtime garbage collector. It is necessary to use this option during the link phase for it to have effect; specifying it additionally during the compilation phase can result in improved performance.

The supplied Technical Information note (TECHINFO) lists whether garbage collection is available for your system. If it is available, there will be a file "gc.o" in the compiler's library directory.

The collector used is based on version 5.3 of the publicly available general purpose garbage collecting storage allocator of Hans-J Boehm, Alan J Demers and Xerox Corporation, described in "Garbage Collection in an Uncooperative Environment" (H Boehm and M Weiser, Software Practice and Experience, September 1988, pp 807-820).

The copyright notice attached to their latest version is as follows:

Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
Copyright (c) 1991-1995 by Xerox Corporation.  All rights reserved.
Copyright 1996-1999 by Silicon Graphics.  All rights reserved.
Copyright 1999 by Hewlett-Packard Company.  All rights reserved.


THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.

Permission is hereby granted to use or copy this program
for any purpose,  provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.

Note that the "NO WARRANTY" disclaimer refers to the original copyright holders Boehm, Demers, Xerox Corporation, Silicon Graphics and Hewlett-Packard Company. The modified collector distributed in binary form with the NAGWare f95 compiler is subject to the same warranty and conditions as the rest of the NAGWare f95 compilation system.

The module F90_GC is provided; it contains functions and variables that can control the behaviour of the garbage collector.

Memory Tracing

Tracing of memory allocation and deallocation is provided by the -mtrace option. Control is provided over whether the address, size, and line number of each allocation is displayed, or the tracing output can be suppressed entirely. A ``paranoia'' mode is provided where the memory allocator protects its data structures against inadvertent modification by the user program.

Runtime environment variables may be used to override the tracing options a program was built with, and to specify where to write the tracing output. These are only operative if the program was built with some tracing option; -mtrace=off will build a program with the tracing-capable memory allocator.

If -mtrace=off is not specified, use of any -mtrace option will implicitly do a -mtrace=on.

Basic tracing produces a message to the memory tracing file (normally standard error) for each allocation and deallocation, including those for automatic variables, i/o buffers and compiler-generated temporaries. Each allocation is numbered sequentially; the first three items are the i/o buffers for units 0, 5 and 6 (standard error, standard input and standard output).

All -mtrace= suboptions may be overridden at run time by the NAGF90_MTRACE_OPTIONS environment variable, which should be set to the required trace_opt_list (e.g. "on,size"). The memory tracing file may be specified at run time by the NAGF90_MTRACE_FILE environment variable.

The -mtrace option must be specified when linking, and is incompatible with -gc. Additionally, line number information is only available for those files compiled with -mtrace=line.

The f95mcheck program can be used to check the output from the -mtrace option. It is designed to be used as a filter. Any lines that do not look like memory tracing output are ignored. It reports to standard output any errors it detects such as deallocating something twice, deallocating something that was never allocated, or deallocating something with a size different from that with which it was allocated. It also reports any apparent memory leaks, though this is less useful if the program terminated prematurely.

Undefined Variable Detection

Use of undefined variables can be detected with the -C=undefined option. Program units compiled with this option are incompatible with program units compiled without this option (i.e. the whole program must be compiled the same way). For this reason, -C=undefined is not part of -C or -C=all.

Currently, there are a number of other limitations on the use of -C=undefined.

  1. It is incompatible with ALLOCATABLE functions.
  2. It is incompatible with pointers in an initialised COMMON.
  3. The only intrinsic modules available with it are F90_KIND, F90_STAT and F90_IOSTAT.
  4. Internal READ from a CHARACTER array requires the entire specified array subobject to be ``defined'', even those elements corresponding to records not actually read.
  5. Internal WRITE to a CHARACTER array is considered to define the entire specified array subobject, even those elements corresponding to records not actually written.
  6. Certain intrinsic functions require the entirety of their arguments to be defined, even if some portions are not actually required for the value of the function. For example, the PAD argument to RESHAPE when no padding is actually required, and elements of the ARRAY argument to PACK that correspond to false elements of the MASK argument.

Debugging

For details on the Fortran-90-aware debugger see upsf95(1). This may not be available on some systems.

In general, host system debuggers, such as dbx, may be used successfully on Fortran code as the names of the original source files, plus line numbers, are passed through to the intermediate C files. In using such debuggers it should be noted that most local variables have an underscore appended to their names. It may be useful to look at the intermediate C code when debugging; this is produced by the -S option.

Modules

To use a module it must be pre-compiled, or must be defined in the file prior to its use. When separately compiling a module the -c option should be specified.

Compiling a module creates a `.mod' file and usually a `.o' file. The `.mod' file is used by the compiler at compile time to provide information about module contents, the `.o' file (if generated) contains the code of any module procedures and must be specified when creating an executable file.

Note that the name of the `.mod' file will be the name of the module, the `.o' file will be named after the original source file.

When a precompiled module is USEd the f95 compiler attempts to find its source file and, if that is successful, checks the modification times producing a warning message if the `.mod' file is out of date.

NAG-supplied modules are described in the man page nag_modules.

See Also

ar(1), cc(1V), f90_gc(3), f90_iostat(3), f90_kind(3), f90_preconn_io(3), f90_stat(3), f90_unix(3), f90_unix_dir(3), f90_unix_dirent(3), f90_unix_env(3), f90_unix_errno(3), f90_unix_file(3), f90_unix_proc(3), f95mcheck(1), fpp(1), ieee_arithmetic(3), ieee_exceptions(3), ieee_features(3), ld(1), nag_modules(3), upsf95(1).

Bugs

Please report any bugs found to "support@nag.co.uk" or "infodesk@nag.com", along with any suggestions for improvements.

Author

Malcolm Cohen, The Numerical Algorithms Group Ltd., Oxford, United Kingdom.