Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

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)

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 Fortran 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 substituted 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 substituted for .dp. 

Arguments whose names end with .F are taken to be Fortran 77 source files containing cpp(1) directives such as #define and #ifdef.  All such files are first processed with cpp(1), producing a .f file which is then compiled by hf77.  Three options are supported for processing 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 produced 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. 

−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 provided 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 produced. 

−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 compilation directives.  The listing produced by the compiler (via −L) will show the conditional compilation directives as comments, and skipped lines as blank lines. 

−f float Use float as the floating point mode during 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 variables 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 argument 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 source file before transforming with the ratfor(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 optimization 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 specified 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; common variables and dummy arguments, and dummy arguments within an argument list, are assumed to be interassociated and individual optimizations 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 following 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 specified. 

−Ono_post_linker
Disables post-linker optimizations if another −O option has been specified. 

−P Instruct the assembler to create a formatted 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 followed 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.

align_double[=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 −Qalign_double=8 is equivalent to the current default operation.  Using the default −Qalign_double=8 option or −Qalign_double aligns variables of these types to double-word boundaries, thus removing the need to manually align the variables or link with one of /lib/handle_misaligned∗.o.  Note that programs compiled with −Qalign_double=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 −Qalign_double=4 as the default.  The −stdf77 option or this option can be used to restore previous, standard-conforming behavior.  The −Qunaligned_args option may be of interest if using the standard conforming −Qalign_double=4 alignment. 

avoid_overflow
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 efficient implementation can encounter overflow on intermediate results even though the final answer is representable.  This is possible only if the real or imaginary portions 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 values to maximize the execution speed of generated code.  It is equivalent to:  −O3 −Qopt_class=unsafe −Qobjects=10000 −Qloops=1000 −Qgrowth_limit=10000 −Qfast_math −Qblock_limit=10000 −Qvariable_limit=10000.  If further execution speed is desired, but at the expense of lost exception detection, see the −Qdiv_pow2 and −Qfast_math options.  The fast math library /lib/libM.a, available 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. 

block_limit=N
Hf77 Fortran only. Limit the number of common 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. 

div_pow2
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. 

fast_math
Series 4000 and 5000.  Permit the compiler to perform floating point operations with faster integer instructions that do not generate floating point exceptions or handle special IEEE values such as NaN. 

file_buffer_limit=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. 

growth_limit=N
Limit the amount of intermediate code the optimizer is allowed to duplicate when performing optimizations such as loop unrolling and when repairing irreducible flow graphs.  The integer constant N represents the percentage increase in code size permitted.  The default is 25. 

inline_divide
Series 4000 and 5000. Generate extra code to detect and perform integer divisions that involve negative numbers without generating 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 divisions of or by negative numbers happens so frequently that the extra overhead of permitting 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.

no_short_circuit
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 .FALSE., (.TRUE. .OR. anything) is .TRUE..  By default the compiler may or may not short circuit .AND. and .OR. logical operators depending on the estimated efficiency of the operations.  In cases where a logical expression consists of scalar variable references, literals, and simple comparisons 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 −Qno_short_circuit 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 optimization level MINIMAL. 

ocs Alter behavior of the compiler to comply with the 88open Object Compatibility Standard (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. 

opt_class={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 variables (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. 

optimize_for_space
Specify that space, rather than time, is the critical factor in optimizing this program.

sync_volatile
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 dependencies 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 reordered by the compiler, the series 5000 processor may internally reorder such operations for efficiency.  Note that this option is rarely necessary. 

unaligned_args
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 −Qalign_double=4 options, dummy arguments of the above types 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 arguments of these types are aligned, so it is still necessary to link with one of /lib/handle_misaligned∗.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 −Qalign_double=4. 

unroll_limit=N
Limit the number of times a loop may be unrolled.  N must be an integer between 0 and 8.  The default is 4. 

variable_limit=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 program 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 -Qblock_limit=N option for more information. 

−R The remaining characters in the argument are used as a RATFOR flag argument whenever processing a .r file. 

−stdf77 Compile as a ANSI standard Fortran 77 compiler.  Currently this is equivalent to specifying the following options:

-Qalign_double=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 argument.

1 pass 1 processor
a assembler
c C compiler
F runtime startoff routine
r instruction reorder tool (Series 4000 and 5000)
l link editor
C cpp-style macro pre-processor (for .F files)
t temporary file prefix
z post-link optimization tool (Series 4000 and 5000)

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 insensitive language (i.e., ascent and ASCENT are considered the same name); with −U case is significant (ascent and ASCENT are distinct names.) 

−U symbol-name
If −U is followed by a name consisting of alphanumeric and "_" characters, it is interpreted 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 implicit 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 (rightmost) bit of the variable is used.  Other bits of the variable are unaffected.  This option cannot be used with −Qno_short_circuit 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 −Qno_short_circuit and −Qocs. 

−v Verbose mode. Provide diagnostics for each process during compilation. 

−w or −ww Suppress both warning and caution messages. 

−wc Suppress only caution messages. 

−xref  [,gen_only] [,interface] [,sdf=filename] [,overwrite] [,−lint,−o=filename ...]
Generate source description file (SDF) and use xref(1) to produce a cross-reference listing.  gen_only prevents invocation of xref.  interface generates interface descriptions only.  Compiling 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 produced 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 compilation 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

/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 executable which contains a variable initialized with or assigned a Not-a-Number value with one of the NAN$ constant intrinsics and fails to redefine the variable before use will receive a floating point exception with the message "Floating 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 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 examine the source for an operation involving a variable which may contain NaN.  For information on possible program optimizations, please see the Program Optimization chapter of the CX/UX Programmer’s Guide. 

CX/UX Fortran Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026