NAG Fortran Compiler Release 5.2
1
Name
nagfor — NAG Fortran Compiler Release 5.2
2
Usage
nagfor [option]... file...
3
Description
nagfor is the NAG Fortran 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 (extension) of a filename determines the action that the compiler
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.
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.
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.
(Note that on Mac OS 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 nagfor 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 nagfor are passed to the link phase
(cc, gcc, c89 or xlc).
4
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
- (AMD64 only)
Specify the ABI to compile for, either 32 (the 32-bit ABI),
64t (the AMD 64-bit ABI) or 64 (the AMD 64-bit ABI with
object sizes limited to 2 GB).
Programs compiled with -abi=64t or -abi=64
will only run on 64-bit kernels.
Programs compiled with -abi=32
will run on any x86 Linux system.
The default is -abi=64t.
The -abi=64 option should only be used to generate code
compatible with NAGWare Release 5.1(346) or earlier, it will be withdrawn
at a future release.
- -abi=abi
- (64-bit Intel Mac only)
Specify the ABI to compile for, either 32 (the 32-bit ABI)
or 64 (the 64-bit ABI). The default is -abi=64.
- -align=alignment
- (Mac OS 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.
These options are positional and can be used to selectively bind some libraries
statically and some dynamically.
- -c
- Compile only (produce .o file for each source file), do not link the .o files
to produce an executable file.
- -C
- Compile with all but the most expensive runtime checks;
this omits the -C=dangling and -C=undefined
options.
- -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) or |
| undefined | (check for undefined variables). |
The -C=recursion option is incompatible with the
-thread_safe option and will be ignored if the latter is used.
The -C=undefined option is subject to a number of limitations
and is not binary-compatible with code compiled without that option; see the
Undefined Variable Detection
section for further 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:
| Non-standard | Equivalent Standard Fortran 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).
- -english
- Produce compiler messages in English (default).
- -extend_c_interop
- Enable the non-standard C interoperability extension of allowing a
BIND(C) procedure to be ELEMENTAL.
- -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.
- -f2003
- Specify that the base language is Fortran 2003.
(The default in this release is Fortran 95.)
With this option, Fortran 2003 features will not be reported as extensions.
- -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.
On Windows it also causes use of the “STDCALL” calling convention that
is commonly used for most DLLs.
- -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 file.
- -framework f
- (Mac OS 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
- Produce debugging information for dbx90, a Fortran 90 aware front-end to the
host system debugger.
This produces a debug information (.g90) file for each Fortran source file.
This option must be specified for both 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.
For more details see the
Automatic Garbage Collection
section.
- -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.
For example:
Runtime Error: Invalid input for real editing
Program terminated by I/O error on unit 5 (Input_Unit,Formatted,Sequential)
main.f90, line 28: Error occurred in READ_DATA
main.f90, line 57: Called by READ_COORDS
main.f90, line 40: Called by INITIAL
main.f90, line 13: Called by $main$
- -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
(see the -Qpath option).
- -ieee=mode
- Set the mode of IEEE arithmetic operation according to mode,
which must be one of full, nonstd or stop.
- full
- enables all IEEE arithmetic facilities including non-stop arithmetic.
- nonstd
- Disables non-stop arithmetic, terminating execution on floating
overflow, division by zero or invalid operand.
If the hardware supports it, this also disables IEEE gradual underflow,
producing zero instead of a denormalised number; this can improve performance
on some systems.
- stop
- enables all IEEE arithmetic facilities except for non-stop arithmetic;
execution will be terminated on floating overflow, division by zero or
invalid operand.
The -ieee option must be specified when compiling the main
program unit, and its effect is global.
The default mode is -ieee=stop.
For more details see the
IEEE 754 Arithmetic Support
section.
- -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 from 255 to N.
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.
For more details see the
Memory Tracing
section.
- -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.
- -nihongo
- Produce compiler messages in Japanese (using Shift-JIS encoding).
- -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 for -O1 and lower.
- -Opropagate
- Enable the optimisation of constant propagation.
This is the default for -O2 and 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 the Fortran compiler'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 compiler library pathname from its default location to
pathname.
(The default location on Unix is usually
‘/usr/local/lib/NAG_Fortran’ or
‘/opt/NAG_Fortran/lib’, and on Windows is usually
‘C:\Program Files\NAG\EFBuilderPro\NAG_Fortran\lib’.)
- -r8
- Double the size of default REAL and COMPLEX, and on machines for
which quadruple-precision floating-point arithmetic is available, double the
size of DOUBLE PRECISION (and the non-standard DOUBLE COMPLEX).
REAL or 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 only effective if specified during the link phase.
- -S
- Produce assembler (actually C source code).
The resulting .c file should be compiled with the NAG Fortran compiler, 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 non-automatic 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 Linux (x86-32) and Windows, machine may be one of
| i486, i586, i686, pentium2, pentium3, pentium4 |
the specified Intel processor,
|
| k6, k6-2, k6-3, k6-4, athlon, 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 i686.
-
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=native option is not available with gcc.
-
For HP9000/700, machine may be one of
- 2.0
- the specified revision of the PA-RISC architecture (default) or
- native
- the current machine.
- -tempdir directory
- Set the directory used for the compiler's 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.
- -unsharedrts
- Bind with the unshared (static) version of the Fortran runtime system; this
allows a dynamically linked executable to be run on systems where the
NAG Fortran 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, ques, 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=ques
- suppresses warning messages about questionable usage.
- -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 Compiler 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.
A comma may be included in an option by repeating it, e.g.
-Wl,-filelist=file1,,file2,,file3 becomes the linker
option -filelist=file1,file2,file3.
- -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=p_one,p2.
Unlike the -mismatch
option, this only affects data type and arrayness checking, and no warning
messages are produced.
- -xlicinfo
- Report on the availability of licences for the compiler instead of compiling
anything.
- -xs
- (Sun/SPARC option only)
Store the symbol tables in the executable (otherwise debugging is
only possible if the object files are kept).
5
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
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
Free-form Fortran 90/95 preprocessor file.
file.F90
(Unix)
Free-form Fortran 90/95 preprocessor file.
file.ff95
Free-form Fortran 90/95 preprocessor file.
file.F95
(Unix)
Free-form Fortran 90/95 preprocessor file.
name.mod
Compiled module information file; name is the name of the module in lower
case.
file.o
Object file
| /opt/NAG_Fortran/lib |
Default NAG Fortran Compiler library directory on Sun Solaris (see
-Qpath); referred to as library hereafter.
|
| /usr/local/lib/NAG_Fortran |
Default NAG Fortran Compiler library directory on other Unix-based operating
systems.
|
| C:\Program Files\NAG\EFBuilderPro\NAG_Fortran\lib |
Default NAG Fortran Compiler library directory on Windows.
|
library/f90_iostat.f90
Source code for the f90_iostat module.
library/f90_kind.f90
Source code for the f90_kind module.
library/f90_stat.f90
Source code for the f90_stat module.
library/f90_util.f90
A sample Fortran 90 program that displays implementation-specific information
library/iso_fortran_env.f90
Source code for the iso_fortran_env module.
library/nagfmcheck.f90
Source code for the nagfmcheck program, see the
Memory Tracing
section.
6
Compilation Messages
The messages produced by the NAG Fortran Compiler 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 |
the source code appears likely to be in error.
|
| Questionable |
some questionable usage has been found in the source code which may indicate a
programming error.
This has the same severity as “warning”.
|
| Extension |
some non-standard-conforming source 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 source 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.
|
7
Compiler Limits
| Item | Limit |
| 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 | 99 |
| Maximum array-constructor-implied-DO loop nesting | 99 |
| Maximum number of dummy arguments | 32767 |
| Maximum number of arguments to MIN and MAX | 100 |
| Maximum character length | 2147483647 |
| Maximum array size (32-bit systems) | 2147483647 bytes |
| Maximum array size (64-bit systems) | 64GB |
| Maximum unit number | 2147483647 |
| Maximum I/O record length | 2147483647 |
8
Input/Output Information
| Item | Value |
| 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 the Windows temporary directory on Windows.
This default may be overridden with the TMPDIR environment variable.
9
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 a formatted connection is opened with
BLANK='NULL' and POSITION='REWIND' (see
module F90_PRECONN_IO).
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.
10
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.
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.
11
Random Number Algorithm
The random number generator supplied as the intrinsic subroutine
RANDOM_NUMBER is the “Mersenne Twister”.
12
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
NAG Fortran Compiler is subject to the same warranty and conditions as the
rest of the NAG Fortran compilation system.
The module F90_GC
is provided; it contains functions and variables that can control the behaviour
of the garbage collector.
13
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
NAGFORTRAN_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
NAGFORTRAN_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 nagfmcheck 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.
14
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.
-
It is incompatible with ALLOCATABLE functions.
-
It is incompatible with pointers in an initialised COMMON.
-
The only intrinsic modules available with it
are F90_KIND, F90_STAT
and F90_IOSTAT.
-
Internal READ from a CHARACTER array requires the
entire specified array subobject to be “defined”, even those elements
corresponding to records not actually read.
-
Internal WRITE to a CHARACTER array is considered
to define the entire specified array subobject, even those elements
corresponding to records not actually written.
-
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.
15
Debugging
On Windows debugging is built-in to the Fortran Builder.
For operating systems other than Windows a Modern Fortran-aware debugger might
be available as dbx90; see TECHINFO.txt for details.
In general, host system debuggers, such as dbx or gdb, 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.
16
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 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 NAG Fortran 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.
17
Data Types
The table below lists the data types provided by the NAG Fortran Compiler
together with their kind numbers.
There are two possibilities for the KIND numbers: the default mode of operation
(which may be specified explicitly by the -kind=sequential
option) and the “byte” numbering scheme (specified by the
-kind=byte option).
| Type | KIND Number | KIND Number | Description |
| Name | (kind=sequential) | (kind=byte) | |
| REAL | 1 | 4 | Single precision floating-point |
| REAL | 2 | 8 | Double precision floating-point |
| REAL | 3 | 16 | Quadruple precision floating-point |
| | | | |
| COMPLEX | 1 | 4 | Single precision complex |
| COMPLEX | 2 | 8 | Double precision complex |
| COMPLEX | 3 | 16 | Quadruple precision complex |
| | | | |
| LOGICAL | 1 | 1 | Single byte logical |
| LOGICAL | 2 | 2 | Double byte logical |
| LOGICAL | 3 | 4 | Default logical |
| LOGICAL | 4 | 8 | Eight byte logical |
| | | | |
| INTEGER | 1 | 1 | 8-bit integer |
| INTEGER | 2 | 2 | 16-bit integer |
| INTEGER | 3 | 4 | 32-bit (default) integer |
| INTEGER | 4 | 8 | 64-bit integer |
| | | | |
| CHARACTER | 1 | 1 | ASCII character |
Note that on all machines except Sun Solaris with the SunPro C compiler,
quadruple precision is actually “double double” precision; this
provides nearly twice the precision of Double precision but with a reduced
exponent range.
The F90_KIND module contains named parameters useful for specifying
which kind you want regardless of whether the numbering system is
“sequential” or “byte”.
18
Runtime Environment Variables
The following variables control the runtime environment for programs compiled
with the NAG Fortran Compiler.
- NAGFORTRAN_MTRACE_FILE
- Programs compiled using any -mtrace= option will write the
memory trace to this file.
The default is standard error.
- NAGFORTRAN_MTRACE_OPTIONS
- Changes the memory tracing options for programs compiled using any
-mtrace= option.
- NAGFORTRAN_RUNTIME_ERROR_FILE
- Runtime error messages will be written to this file.
The default is standard error.
- NAGFORTRAN_RUNTIME_LANGUAGE
- Controls the language used for runtime error messages.
This may be ‘English’ or ‘Japanese’ (not case-sensitive);
the default is English.
- TMPDIR
- Controls the directory used for scratch files (the default is system-dependent).
Additional intrinsic modules built into the NAG Fortran Compiler
are described in the “nag_modules” document.
19
See Also
ar(1),
cc(1V),
dbx90(1),
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),
fpp(1),
ieee_arithmetic(3),
ieee_exceptions(3),
ieee_features(3),
iso_c_binding(3),
iso_fortran_env(3),
ld(1),
nag_modules(3),
nagfmcheck(1).
20
Bugs
Please report any bugs found to ‘support@nag.co.uk’ or
‘support@nag.com’, along with any suggestions for improvements.
21
Author
Malcolm Cohen, Nihon Numerical Algorithms Group KK, Tokyo, Japan.