hf77(1) hf77(1)
NAME
hf77 - Fortran 77 compiler
SYNOPSIS
hf77 [ options ] files
or
f77 [ options ] files
DESCRIPTION
hf77 accepts several types of file arguments:
Arguments whose names end with .f are taken to be For-
tran 77 source programs; they are compiled and each
object program is left in the current directory in a
file whose name is that of the source, with .o substi-
tuted for .f.
Arguments whose names end with .dp are taken to be hf77
datapool definition files; they are processed and each
dictionary object is left in the current directory in a
file whose name is that of the source, with .o substi-
tuted for .dp.
Arguments whose names end with .F are taken to be For-
tran 77 source files containing cpp(1) directives such
as #define and #ifdef. All such files are first pro-
cessed with cpp(1), producing a .f file which is then
compiled by hf77. Three options are supported for pro-
cessing Fortran source files with cpp(1): -Dsymbol-
name for defining a preprocessor symbol; -Usymbol-name
for undefining a preprocessor symbol; and -Idirectory-
name for adding directories in which to search for
#include files. The name of the intermediate file pro-
duced by cpp(1) is the name of the original source file
with .f substituted for .F.
Arguments whose names end with .r or .e are taken to be
RATFOR or EFL source programs, respectively. These are
first transformed by the appropriate preprocessor, then
compiled by hf77, producing .o files.
In the same way, arguments whose names end with .c or
.s are taken to be C or assembly source programs and
are compiled or assembled, producing .o files.
The following options have the same meaning as in hc(1) (see
ld(1) for link editor options):
-c Suppress link editing and produce .o files for
each source file.
Page 1 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
-g Produce symbolic debug information, which will
permit debugging of the file with dbx(1).
-p Prepare object files for profiling with prof(1).
Note: The format of a profile file is not
guaranteed to be portable across systems pro-
vided by different vendors. In particular,
Motorola 88000 programs which are certified to
conform to the 88open Compatibility Standards
may not have the ability to be profiled on a
foreign system.
-S Compile the named programs and leave the
assembler-language output in corresponding files
whose names are suffixed with .s. ( .o files
are not created.)
-o output Name the final output file output, instead of
a.out.
The following options are peculiar to hf77:
-C Generate code for runtime array range checking.
-check Perform source syntax and semantic checking
only. Useful for quickly verifying source
correctness. No assembly or object file is pro-
duced.
-D The -D option alone treats lines with a "d" or
"D" in column 1 as statements instead of comment
lines. The "d" or "D" is considered a blank in
this case.
-D symbol-name
If followed by a name consisting of alphanumeric
and "" characters, -D is instead interpreted as
a cpp(1) option defining the given name and
affects the processing of .F files.
-d Produce a trace of processor invocations and
compilation phases as they occur.
-F Apply the cpp(1), EFL and RATFOR preprocessor to
relevant files, put the result in files whose
names have their suffix changed to .f. (No .o
files are created.)
-FLAG list Specify flag numbers for VOS-style conditional
compilation directives. The list may contain
zero or more flag numbers (1-23), separated by
commas. Do not leave a space between the -FLAG
and the first flag number. Even if no flags are
going to be specified, it is still necessary to
specify the -FLAG option to successfully compile
any source which contains conditional compila-
tion directives. The listing produced by the
compiler (via -L) will show the conditional com-
pilation directives as comments, and skipped
lines as blank lines.
-f float Use float as the floating point mode during
Page 2 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
compilation, and as the floating point mode of
the resulting object file.
Series 4000 and 5000:
Modes Argument Values
IEEE-COMPATIBLE 3 ieeecom
IEEE-NEAREST 4 ieeenear near
IEEE-ZERO 5 ieeezero zero
IEEE-POS-INFINITY 6 ieeepos pos
IEEE-NEG-INFINITY 7 ieeeneg neg
Any one of the listed Argument Values may be
used for float. If no -f option is provided the
default is IEEE-NEAREST.
-I directory-name
Specifies an alternative directory in which to
search for #include and INCLUDE files. It can
be specified multiple times. This option is
passed to cpp(1) and affects the processing of
.F files. It also extends the search directory
list for files included with the Fortran INCLUDE
statement.
-i size Specify size bytes for integer and logical vari-
ables without declared lengths. The allowed
values are 2 and 4, indicating 2 bytes and 4
bytes, respectively. The default value is 4.
-L [ asa ] Produce a source listing of the code. The
optional argument asa, which can be abbreviated
to a, specifies that the compiler use ASA page
control characters rather than the default when
generating a listing on stdout.
-L directory-name
Add directory-name to the list of directories in
which ld(1) searches for libraries to resolve
external references. If the name of a directory
conflicts with the -La or -Lasa source listing
option, precede the directory name with "./".
-lname Passed on to ld, to search the library libname.a
from /lib, /usr/lib or -L directories, and load
referenced modules from that library into the
executable file.
Series 4000 and 5000. If -lM is specified prior
to any source or object file names in the argu-
ment list, then the /lib/libM.a ``fast math''
library is searched instead of the standard
/lib/libm.a math library. To specify another
libM.a when the fast math library is not
desired, specify the -lM option after the first
source or object file name in the argument list.
-m Apply the M4 preprocessor to each EFL or RATFOR
Page 3 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
source file before transforming with the rat-
for(1) or efl(1) processors.
-N argument Change the default sizes of internal compiler
constructs.
t Specify the maximum size of character strings
allowed by the compiler. This must be a positive number.
The default size is 1023.
Example:
hf77 -Nt3000 t.f
-O [ level ][ safety ]
Set the compiler optimization level. The
optional level argument specifies the optimiza-
tion level to be performed. It may be one of
the following:
<omitted> GLOBAL
1 MINIMAL
2 GLOBAL
3 MAXIMAL
The default level if this option is not speci-
fied is MINIMAL. Safety may be specified by S
for `safe' and U for `unsafe,' with standard as
the default. Requesting safe optimization
causes the compiler to be pessimistic regarding
storage associations: common variables are not
treated as distinct objects; common variables
are assumed modified by any function call; com-
mon variables and dummy arguments, and dummy
arguments within an argument list, are assumed
to be interassociated and individual optimiza-
tions are not performed; constantly-subscripted
array element optimizations are suppressed.
On Series 4000 and 5000 systems instruction
reordering and pipelining are performed at
optimization levels GLOBAL and MAXIMAL. To
suppress such optimizations, supply the follow-
ing option on the command line:
-Tr"/usr/lib/cxf77-reorder -r -l"
Also on Series 4000 and 5000 systems, post-
linker optimizations performed by analyze88(1)
are enabled only if a -O option has been speci-
fied.
-Onopostlinker
Disables post-linker optimizations if another -O
option has been specified.
-P Instruct the assembler to create a formatted
Page 4 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
object listing on standard output. The format
of the printout is:
'line-number pc memory-layout source-line'
The 'pc' field in a .data segment will be fol-
lowed by a '*'.
-pg Prepare object files for profiling with
gprof(1).
-Q argument Specify one of several keywords. Some of these
are common across all compilers and others are
specific to Fortran. Note that some keywords
are specific to a particular Series.
aligndouble[=N]
Hf77 Fortran, Series 4000 and 5000. Specify
byte boundary to which REAL*8, COMPLEX*8
and COMPLEX*16 variables are aligned within
common blocks. Specifying -Qaligndouble=8
is equivalent to the current default opera-
tion. Using the default -Qaligndouble=8
option or -Qaligndouble aligns variables
of these types to double-word boundaries,
thus removing the need to manually align
the variables or link with one of
/lib/handlemisaligned*.o. Note that pro-
grams compiled with -Qaligndouble=8 may
not be strictly standard-conforming as the
standard does not permit gaps in common
block layout. Hf77 6.1.1 and previous
releases used -Qaligndouble=4 as the
default. The -stdf77 option or this option
can be used to restore previous, standard-
conforming behavior. The -Qunalignedargs
option may be of interest if using the
standard conforming -Qaligndouble=4 align-
ment.
avoidoverflow
Hf77 Fortran only. For some complicated
operations such as dividing COMPLEX numbers
or taking the absolute value of a COMPLEX
number, the most straight-forward and effi-
cient implementation can encounter overflow
on intermediate results even though the
final answer is representable. This is
possible only if the real or imaginary por-
tions are greater in magnitude than the
square root of the largest real number
(greater than about 1.844674e+19 for single
precision and 1.340780793e+154 for double
precision.). The use of this option will
cause the compiler to generate slower code
that will not encounter these overflows.
benchmark
Set optimization parameters to very high
Page 5 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
values to maximize the execution speed of
generated code. It is equivalent to: -O3
-Qoptclass=unsafe -Qobjects=10000
-Qloops=1000 -Qgrowthlimit=10000
-Qfastmath -Qblocklimit=10000
-Qvariablelimit=10000.
If further execution speed is desired, but
at the expense of lost exception detection,
see the -Qdivpow2 and -Qfastmath options.
The fast math library /lib/libM.a, avail-
able for Series 4000 and 5000, sacrifices a
small amount of precision for increased
speed. Use the -lM option; see the
description of the -l option for more
information.
blocklimit=N
Hf77 Fortran only. Limit the number of com-
mon blocks that optimizer will consider.
If greater than N (default 128) common
blocks appear in a program unit, all common
block variables in all common blocks are
considered one object during analysis of
interdependence. This limit will rarely be
reached.
divpow2
Series 4000 and 5000. Specify that
floating-point divisions by powers of 2
should be done by adjusting exponents.
This is much faster, but does not detect
overflow or underflow.
fastmath
Series 4000 and 5000. Permit the compiler
to perform floating point operations with
faster integer instructions that do not
generate floating point exceptions or han-
dle special IEEE values such as NaN.
filebufferlimit=N
Specify the amount of internal memory in
bytes that as(1) and ld(1) are to use when
assembling and linking programs. See the
as(1) and ld(1) online man pages for
further details.
growthlimit=N
Limit the amount of intermediate code the
optimizer is allowed to duplicate when per-
forming optimizations such as loop unrol-
ling and when repairing irreducible flow
graphs. The integer constant N represents
the percentage increase in code size per-
mitted. The default is 25.
inlinedivide
Page 6 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
Series 4000 and 5000. Generate extra code
to detect and perform integer divisions
that involve negative numbers without gen-
erating exceptions handled by the operating
system. Normally the compiler generates a
simple divide instruction for all integer
division, and then permits the operating
system to complete the instruction when
negative numbers are divided. This option
may be used for applications where divi-
sions of or by negative numbers happens so
frequently that the extra overhead of per-
mitting the operating system to handle the
exceptions has a significant performance
impact. Of course the disadvantage of this
option is that extra code is generated for
all divisions, even those that do not
involve negative numbers. No exception is
generated when dividing MININT (-(MAXINT) -
1) by -1, thus an executable is not BCS-
compliant if built with this option.
loops=N
Limit the number of loops for which the
compiler will perform the copy-variable
optimization. The default is 20.
noshortcircuit
Hf77 Fortran only. Do not short circuit
logical operations. Unlike the other three
binary logical operators, it is possible
that the result of the .AND. or .OR. may be
known by evaluating only the first operand,
i.e. (.FALSE. .AND. anything) is By default
the compiler may or may not short circuit
.AND. and the operations. In cases where a
logical expression consists of scalar vari-
able references, literals, and simple com-
parisons of the same, the full logical
expression is evaluated. In cases where a
logical expression has more complicated
operands with possible side effects, it is
short circuited. Therefore, short circuit
semantics are maintained unless the
-Qnoshortcircuit option is specified.
objects=N
Set the maximum number of variables that
the compiler will optimize when GLOBAL or
MAXIMAL optimization is specified to N,
where N must be an integer constant. The
default if this option is not specified is
128. This option has no effect at optimi-
zation level MINIMAL.
Page 7 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
ocs Alter behavior of the compiler to comply
with the 88open Object Compatibility Stan-
dard (OCS). This effects interpretation of
logical expressions, how arguments are
passed to subprograms, how results are
received from functions, name space in
object files, etc. See Appendix H of the
CX/UX Hf77 Fortran Reference Manual for
details.
optclass={safe,standard,unsafe}
Set the optimization class to one of safe,
standard or unsafe. The class standard
means to believe the Fortran 77 standard
and assume that arguments to subprograms do
not alias each other or common block vari-
ables (that is, that there are not two
names that can refer to the same storage,
other than those in the same EQUIVALENCE
class). The class safe means to assume
that arguments can alias other variables.
The class unsafe is intended for making
risky assumptions, but is not currently
different from standard. The default is
standard.
optimizeforspace
Specify that space, rather than time, is
the critical factor in optimizing this pro-
gram.
syncvolatile
Series 4000 and 5000. Generate processor
sync instructions prior to loading and
storing volatile variables. In certain
specialized applications such as device
drivers the values of volatile variables
may be affected by reads and/or writes of
other volatile locations, creating depen-
dencies which are not obvious from the
source code. If the order of the loads and
stores of distinct volatile locations must
be preserved, specify this option.
Although load and store instructions
involving volatile variables are not reor-
dered by the compiler, the series 5000 pro-
cessor may internally reorder such opera-
tions for efficiency. Note that this
option is rarely necessary.
unalignedargs
Hf77 Fortran, Series 4000 and 5000. Assume
that REAL*8, COMPLEX*8 and COMPLEX*16 dummy
arguments are unaligned. When compiling
with the -stdf77 or -Qaligndouble=4
options, dummy arguments of the above types
Page 8 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
are accessed in a slightly slower but
always safe manner, avoiding misaligned
access exceptions. Note that this applies
only to user subroutines. Library routines
and I/O operations still assume that argu-
ments of these types are aligned, so it is
still necessary to link with one of
/lib/handlemisaligned*.o. Hf77 6.2 and
later releases align double-word common
variables on double-word boundaries by
default, removing the need for this option
unless forcing single-word alignment with
-Qaligndouble=4.
unrolllimit=N
Limit the number of times a loop may be
unrolled. N must be an integer between 0
and 8. The default is 4.
variablelimit=N
Hf77 Fortran only. Restrict the number of
distinct common block variables considered
for optimization. If greater than N
(default 128) common variables are used in
a program unit, all common variables in
each common block are considered one object
during analysis of interdependence. A pro-
gram unit using many common variables, some
intensively, may derive some benefit from
increasing this limit at the expense of
additional compilation time. Should this
limit be invoked, there is another limit on
the number of common blocks that may be
considered for optimization. See the
description of the -Qblocklimit=N option
for more information.
-R The remaining characters in the argument are
used as a RATFOR flag argument whenever process-
ing a .r file.
-stdf77 Compile as a ANSI standard Fortran 77 compiler.
Currently this is equivalent to specifying the
following options:
-Qaligndouble=4
-T argument Invoke a processor other than the default for a
particular phase of compilation. One of the
following characters must appear after the argu-
ment.
1 pass
a assembler
c C compiler
F runs
ti
ta
me
rtoff
r insr
te
ro
uc
rd
te
io
rn
Page 9 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
l line
kditor
C cpp-
ma
sc
tr
yl
oe
t temf
pi
ol
ra
ery
z poso
t-
pl
tim
ni
kzation
The name of the processor, routine, or prefix
must follow the character. If arguments are to
be passed to the processor, a character string
containing the processor name and arguments
within quotes should be used. For example:
-Tamyas -Ta"myas -opt"
-U The -U option alone instructs hf77 to not fold
cases. Fortran 77 is normally a case insensi-
tive language (i.e., ascent and ASCENT are con-
sidered the same name); with -U case is signifi-
cant (ascent and ASCENT are distinct names.)
-U symbol-name
If -U is followed by a name consisting of
alphanumeric and "" characters, it is inter-
preted as a cpp(1) option undefining the given
name and therefore affects the processing of .F
files.
-u Make the default type of a variable undefined,
rather than using the default Fortran 77 impli-
cit typing rules.
-V Instructs the compiler to interpret logical
variables and perform logical operations similar
to the method used by VAX Fortran (VAX is a
trademark of Digital Equipment Corp.) When
determining truth values and performing logical
operations, only the least-significant (right-
most) bit of the variable is used. Other bits
of the variable are unaffected. This option
cannot be used with -Qnoshortcircuit and
-Qocs.
-VAX Puts the compiler in VAX-compatible mode. This
option implies the -V option as described above,
and also implements VAX Fortran tab format
lines. See the CX/UX Hf77 Fortran Reference
Manual for further details. Future releases may
contain further VAX Fortran extensions affected
by this option. This option cannot be used with
-Qnoshortcircuit and -Qocs.
-v Verbose mode. Provide diagnostics for each pro-
cess during compilation.
-w or -ww Suppress both warning and caution messages.
-wc Suppress only caution messages.
[,-lint,-o=filename ...]
-xref [,genonly] [,interface] [,sdf=filename] [,overwrite]
Generate source description file (SDF) and use
Page 10 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
xref(1) to produce a cross-reference listing.
genonly prevents invocation of xref. interface
generates interface descriptions only. Compil-
ing a library, say, with -xref,interface creates
SDFs which contain only a description of the
call interface to each subroutine or function
defined. This special SDF may be used later as
input to xref to describe called subprograms for
which complete information is either unavailable
or unnecessary. The default SDF name for file.f
is file.x. sdf=filename places the SDF in
filename and appends rather than overwrites the
contents, so specifying several source files
will result in all SDFs appended to filename.
overwrite forces overwrite of filename. Options
on -xref starting with dash "-" are passed
directly to xref. Any such options which
require an argument, as -o in the example above,
are specified together with their argument using
"=" as a separator. See the xref(1) man page
for further details about the various xref
options.
The -check compiler option may be useful for
suppressing complete compilation.
Other arguments are taken to be either link-editor option
arguments or hf77-compilable object programs (typically pro-
duced by an earlier run), or libraries of hf77-compilable
routines. These programs, together with the results of any
compilations specified, are linked (in the order given) to
produce an executable program with the default name a.out.
FILES
file.[frescF(dp)] input file
file.o object file
file.x source description file, input to
xref(1).
a.out default linked output name
/usr/tmp/F77[pid].? temporary file, removed after compila-
tion completed
/usr/bin/hf77 Compiler driver
/usr/bin/f77 Alternate name for compiler driver
/usr/lib/cxf77 compiler
/usr/lib/cxf77-reorder
compiler-specific instruction reorder
tool (Series 4000 and 5000)
/bin/analyze88 Post-link optimizer and object code
analyzer.
/usr/bin/xref cross-reference analysis tool
/lib/crt0.o runtime startoff
Page 11 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
/lib/mcrt0.o profiling runtime startoff for use with
prof(1)
/lib/gcrt0.o profiling runtime startoff for use with
gprof(1)
/lib/ocs.o OCS compliance indicator
/lib/vax.o VAX emulation indicator
/usr/lib/libhF77.a Fortran intrinsic function library
/usr/lib/libhI77.a Fortran I/O library
/usr/lib/libhU77.a Fortran system service library
/usr/lib/libp/libh[FIU]77.a
profiled versions of Fortran libraries
/lib/libm.a math library
/lib/libattc.a C library
/lib/libp/lib*.a profiled versions of system libraries
/usr/88open/lib/crt0.o
runtime startoff (88open OCS only)
/usr/88open/lib/mcrt0.o
profiling runtime startoff (88open OCS
only)
/usr/88open/lib/gcrt0.o
profiling runtime startoff (88open OCS
only)
/usr/88open/lib/libm.a
math library (88open OCS only)
/usr/88open/lib/libattc.a
C library (88open OCS only)
SEE ALSO
analyze88(1), as(1), asa(1), cc(1), cpp(1), dbx(1), efl(1),
f77(1), fsplit(1), gprof(1), hc(1), ld(1), m4(1), prof(1),
ratfor(1), xref(1), CX/UX Hf77 Fortran Reference Manual,
Program Optimization chapter of CX/UX Programmer's Guide.
DIAGNOSTICS
The diagnostics produced by hf77 itself are intended to be
self-explanatory. Occasional messages may be produced by
the link editor ld(1).
NaN floating point exceptions within executables. An execut-
able which contains a variable initialized with or assigned
a Not-a-Number value with one of the NAN$ constant intrin-
sics and fails to redefine the variable before use will
receive a floating point exception with the message "Float-
ing invalid operation -- NaN encountered." (SIGFPE, code
FLT_FLTNAN_TRAP on Series 4000 and 5000.) Examining the
operation of the executable from within a debugger will
assist in pinpointing the problem. Assignment of NaN may
not generate NaN exceptions, but arithmetic operations
always will.
NaN floating point exceptions within the compiler. Hf77
itself may receive a floating point exception caused by a
Page 12 CX/UX Fortran Reference Manual
hf77(1) hf77(1)
NaN value, either because of source code which specifies a
NaN bit pattern via a hexadecimal or other constant to be
used as a floating point constant, or through optimizing
transformations of code containing a NAN$ intrinsic. For
the first case, if a NaN value is required, the appropriate
NAN$ constant intrinsic should be used rather than a hard-
coded bit pattern. See nan$(3f), dnan$(3f), cnan$(3f),
znan$(3f). Regarding the second case, a NaN exception thus
generated will produce an error message containing the
string "during constant folding," indicating that the code
contains an arithmetic operation which would use a NaN value
as determined by the compiler's CCG optimizer. The compiler
will report the source file line number containing the
operation that caused the exception. The user should exam-
ine the source for an operation involving a variable which
may contain NaN. For information on possible program optim-
izations, please see the Program Optimization chapter of the
CX/UX Programmer's Guide.
Page 13 CX/UX Fortran Reference Manual