Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ f77(1) — Sun FORTRAN 1.3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

dbx(1)

fpr(1)

fsplit(1)

gprof(1)

ld(1)

perror(3f)

prof(1)

sbrowser(1)

tcov(1)

F77(1)  —  USER COMMANDS

NAME

f77 − Sun FORTRAN compiler

SYNOPSIS

f77 [ −66 ] [ −a ] [ −align _block _ ] [ −ansi ] [ −c ] [ −C ] [ −cg87 ] [ −cg89 ] [ −dalign ] [ −dryrun ]

[ −Dname[=def ] ] [ −e ] [ −fast ] [ −fnonstd ] [ −f ] [ −ffloat_option ] [ −fstore ] [ −F ] [ −g ]

[ −help ] [ −i2 ] [ −i4 ] [ −Ipath ] [ −J ] [ −libmil ] [ −lx ] [ −Ldir ] [ −misalign ] [ −nolibmil ]

[ −N[cdlnqsx]nnn ] [ −o output ] [ −onetrip ] [ −O[1234] ] [ −p ] [ −pg ] [ −pic ] [ −PIC ]

[ −pipe ] [ −Qoption prog opt ] [ −Qpath pathname ] [ −Qproduce sourcetype ] [ −r4 ] [ −r8 ]

[ −sb ] [ −S ] [ −temp=dir ] [ −time ] [ −u ] [ −U ] [ −v ] [ −V ] [ −w ] [ −w66 ] [ −xl[d] ]   sourcefile ...

DESCRIPTION

f77 is the Sun FORTRAN compiler, which translates programs written in the Sun FORTRAN programming language into executable load modules or into relocatable binary programs for subsequent linking by ld(1).  Sun FORTRAN is a superset of FORTRAN 77, with many extensions, including those to provide compatibility with VMS FORTRAN . 

If you installed into the standard, default directory, then before you use the f77 command, insert /usr/lang at the beginning of your search path.  If you installed into a non-default directory such as /your/dir, then insert /your/path at the beginning of your search path.  This is usually done in the .cshrc file, in a line with set PATH = at the start. 

If you installed into the standard, default directory, then before you use the man command for f77 man pages, insert /usr/lang at the beginning of your man path.  If you installed into a non-default directory such as /your/dir, then insert /your/path /man at the beginning of your search path.  This is usually done in the .cshrc file, in a line with set MANPATH = at the start. 

Files with names ending in .f or .for are taken to be Sun FORTRAN source files; they are compiled, and each object program is put in the current directory in a file with the same name as the source, with .o substituted for the .f or .for. 

Files with names ending in .F are also taken to be Sun FORTRAN source files, but they are preprocessed by the C preprocessor (equivalent to a cc −E command) before they are compiled by the f77 compiler. 

Files with names ending in .s are taken to be assembly source files and are assembled, producing .o files. 

Files with names ending in .il are taken to be in-line expansion code template files.  The compiler uses these to expand in-line calls to selected routines when the −O option is in effect.  It’s the compiler, not the linker, that does this, so if you want in-line expansion, be sure to include these .il files in the compile command.  (You don’t need to specify these files if you use the −fast option.) 

OPTIONS

See ld(1) for link-time options. 

−66 Report non-FORTRAN 66 constructs as errors. 

−a Insert code to count how many times each basic block is executed.  Invokes a runtime recording mechanism that creates a .d file for every .f file (at normal termination).  The .d file accumulates execution data for the corresponding source file.  The tcov(1) utility can then be run on the source file to generate statistics about the program.  For separate compile and link steps: if you compile with −a, then be sure to link with −a. 
−a overrides −O. 

−align  _block_
Cause the common block whose FORTRAN name is block to be page-aligned: its size is increased to a whole number of pages, and its first byte is placed at the beginning of a page.  For example, the command “f77 -align _BUFFO_ growth.f” causes BUFFO to be page-aligned.  This option applies to uninitialized data only: if any variable of the common block is initialized in a DATA statement, then the block will not be aligned.  This option is passed to the linker, and is not used at all by the compiler. 

−ansi Identify many non-ANSI extensions. 

−c Compile only; suppress linking by the loader, ld(1), and produce a .o file for each source file.  You can name a single object file explicitly using the −o option. 

−C Compile code to check that subscripts are within the declared array bounds. 

−cg87 Sun-4 only.  Generate code for both the old and newer Sun-4.  It does not exploit features such as the fsqrts and fsqrtd instructions that are implemented in hardware on only the newer Sun-4.  Use the fpversion(1) command to tell you which floating-point hardware you have, and which floating-point option to use.  It may take about a minute to display its report. 

−cg89 Sun-4 only.  Generate code for any newer Sun-4 that has features like hardware fsqrts and fsqrtd instructions.  Code compiled with -cg89 should not be executed on Sun-4/1xx and 4/2xx systems with Weitek 1164/5 floating-point hardware.  Use the fpversion(1) command to tell you which floating-point hardware you have, and which floating-point option to use.  It may take about a minute to display its report. 

−dalign Sun-4 only.  Generate double load/store instructions wherever possible for faster execution.  Using this option automatically triggers the −f option (see  below) to cause all double typed data to be double aligned.  With −dalign , you may not get ANSI standard FORTRAN alignment — a tradeoff of portability for speed.  See also “Shared Libraries” in Programming Utilities and Libraries .  If you compile one module with −dalign, compile all modules of the program with −dalign.  −dalign is unsuitable for modules that access double-precision data that is not aligned on 8-byte boundaries; unexpected bus errors may occur. 

−dryrun Show but do not execute the commands constructed by the compiler driver. 

−Dname[=def ]
Define a symbol name to the C preprocessor, cpp(1).  Equivalent to a “#define” directive in the source.  If no def is given, name is defined as “1” ( .F suffix files only). 

−e Accept extended source lines, up to 132 characters long. 

−f Align local data and common blocks on 8-byte boundaries.  Resulting code may not be standard and may not be portable.  If you compile one module with −f, compile all modules of the program with −f. 

−fast Select the combination of compilation options that optimizes for speed of execution without excessive compilation time.  This should provide close to the maximum performance for most realistic applications.  For some critical routines it may be better to try for more optimization with the -fast -O3 combination.  If you combine −fast with other options, the last specification applies.  Although the optimization part of -fast is -O2, the optimization part of -fast -O3 is -O3.  It is a convenience option, and it chooses the fastest code generation option available on the compile-time hardware ( −cg8x), an optimization level ( −O2), a set of inline expansion templates, the −fnonstd floating-point option, and on a Sun-4, the −dalign option.  For detail on the constituent options of −fast , see the Sun FORTRAN User’s Guide , especially at the end of the chapter Using the Compiler .  Do not use this option for programs that depend on IEEE standard exception handling; you can get different numerical results, premature program termination, or unexpected SIGFPE signals.  If you comple with −fast on a Sun386i, you may get the message
"No Weitek floating point present!" The code being generated is correct, but the message can not be suppressed. So ignore the warning message. 

−fnonstd Do nonstandard initialization of floating-point arithmetic hardware.   By default, IEEE 754 floating-point arithmetic is nonstop and underflows are gradual (except for −f3167 on a Sun-386i, which does not implement gradual underflow).  Specifying −fnonstd during the link step is like having the following at the start of a main program. 

call abrupt_underflow()
i = ieee_handler ("set", "common", SIGFPE_ABORT )

The abrupt_underflow() makes underflows always produce zero rather than a possibly subnormal number, as the IEEE standard requires.  This may be faster on a Sun-3 FPA and FPA+and on a Sun-4.  See ieee_functions(3m). 

The −fnonstd option enables hardware traps for floating-point overflow, division by zero, and invalid operation exceptions.  These are converted into SIGFPE signals, and if the program has no SIGFPE handler, it aborts. See ieee_handler(3m). 

Finally, −fnonstd disables the hardware trap on the first inexact Sun-3 FPA result.  This simplifies debugging but means that inexact FPA exceptions are not detected. 

−ffloat_option
If you compile one module with a particular −ffloat_option, then be sure to compile all modules of that program  with the same −ffloat_option.  See the Sun Numerical Computation Guide . 

−f3167 Sun386i only.  Generate code that assumes the presence of the Weitek WTL 3167 Floating-Point Coprocessor. 

−f68881 Sun-3 only.  Generate code that assumes the presence of the Motorola MC68881 floating-point accelerator board. 

−f80387 Sun386i only.  Generate code that assumes the presence of the Intel 80387 Numeric Processor Extension — default for Sun386i. 

−ffpa Sun-3 only.  Generate code that assumes the presence of the Sun-3 Floating-Point Accelerator board. 

−ffpaplus
Sun-3 only. This is the same as −ffpa , but it is for the FPA+ card. 

−fsoft Generate code that uses software floating-point calls (this is the Sun-3 default). 

−fswitch Run-time-switched floating-point calls.  This option is provided only for backward compatibility.  It is obsolete and is not recommended.  What −fswitch does is cause compiled object code to be linked at runtime to routines that support the FPA, MC68881, or software-floating-point calls, depending on what is available.  You should instead compile and bind a complete executable file for each floating-point option you wish to use, then use the utility foption in a shell script to switch among those executable files. 

−fstore Sun-3 only.  Insure that expressions allocated to extended precision registers are rounded to storage precision whenever an assignment occurs in the source code.  Only has effect when −f68881 is specified. 

−F Apply the C preprocessor to relevant files and put the result in the file with the suffix changed to .f, but do not compile. 

−g Produce additional symbol table information for dbx(1) or dbxtool(1).  Also, pass the −lg flag to ld(1).  For separate compile and link steps: if you compile with −g , then be sure to link with −g .  The −g overrides −O. 

−help Display an equivalent of this list of options. 

−i2 Make the default size of integer and logical constants and variables two bytes.  INTEGER∗n uses n bytes, regardless. 

−i4 Make the default size of integer and logical constants and variables four bytes.  INTEGER∗n uses n bytes, regardless. 

−Ipath Add path to the list of directories in which to search for “#include” files with relative pathnames (not beginning with /).  Search first for “#include” files whose names do not begin with / in the directory containing the source file, then in directories named in −I options, and finally in directories on a standard list with .F suffix files only.  Note that this does not affect FORTRAN’s INCLUDE statement, only the C preprocessor’s.  For example, “f77 -I/usr/applib growth.f” causes the compiler to search for “#include” files in /usr/applib . 

−J Construct 32-bit-wide jump tables for computed GO TO’s. 

−lx Pass this to the loader.  See ld(1).  The loader will link with object library libx.a, where x is a string.  For example, −lm links in the Sun math library, libm.a, which has a lot of the IEEE math routines; this gives optimum performance for most programs, but is application dependent.  As another example, −lV77 links in the library libV77.a, which has the VMS routines that are in conflict with other Sun routines.  The loader will search these directories, in the following order. 

1.  /usr/lang/SC0.0/
2. /lib/
3. /usr/lib/
4. /usr/local/lib/

−libmil Select the best inline templates for the floating-point option and SunOS release available on this system. 

−Ldir Add dir to the list of directories containing object-library routines (for linking using ld(1)). 

−misalign Sun-4 only.  Allow for misaligned data in memory.  Use this option only if you get a warning that COMMON or EQUIVALENCE statements cause data to be misaligned. 
WARNING: With this option, the compiler will generate much slower code for references to dummy arguments. If you can, you should recode the indicated section instead of recompiling with this option.  For example, the program

INTEGER∗2   I(4)
REAL        R1, R2
EQUIVALENCE (R1, I(1)), (R2, I(2))
END

causes the error message

"misalign.f", line 4: Error: bad alignment for "r2"
                      forced by equivalence

−nolibmil Reset −fast so that it does not include inline templates.  Use this after the −fast option: f77 −fast −nolibmil ... 

−N[cdlnqsx]nnn
Make static tables in the compiler bigger. f77 complains if tables overflow and suggests you apply one or more of these flags.  These flags have the following meanings:

−Nc Maximum depth of nesting for control statements (for example, DO loops).  The default is 20. 

−Nd Maximum depth of nesting for data structures and unions.  The default is 20. 

−Nl Maximum number of continuation lines for a continued statement. The default is 19 (1 initial and 19 continuation). 

−Nn Maximum number of identifiers.  The default is 1009. 

−Nq Maximum number of equivalenced variables.  The default is 150. 

−Ns Maximum number of statement numbers.  The default is 401. 

−Nx Maximum number of external names (common block names, subroutine and function names).  The default is 200. 

−o output Name the final output file output instead of a.out. 

−onetrip Compile DO loops so they are performed at least once if reached.  Sun FORTRAN DO loops are not performed at all if the upper limit is smaller than the lower limit, unlike some FORTRAN 66 implementations of DO loops. 

−O[1234]
Optimize the object code. Either one of −a or −g, suppresses −On. 

−O This level of optimization is the most likely to give the fastest performance for most reasonable applications.  Currently this defaults to −O3. 

−O1 Do postpass assembly-level optimization (peephole) only. 

−O2 Do global optimization prior to code generation, including loop optimizations, common subexpression elimination, copy propagation, and automatic register allocation.  −O2 does not optimize references to or definitions of external or indirect variables. 

−O3 Besides what −O2 does, this also optimizes references and definitions of external variables.  The −O3 does not trace the effects of pointer assignments.  Do not use −O3 when compiling either device drivers, or programs that modify external variables from within signal handlers. 

−O4 For FORTRAN, this is the same as −O3. 

−p Prepare the object files for profiling with prof(1).  This does profiles by procedure, showing the number of calls to each procedure and the percent of time used by each procedure.  For separate compile and link steps: if you compile with −p, then be sure to link with −p. 

−pg Prepare the object files for profiling with gprof(1).  This does profiles by procedure, showing the number of calls to each procedure and the percent of time used by each procedure.  This produces counting code in the manner of −p, but invokes a runtime recording mechanism that keeps more extensive statistics and produces a gmon.out file at normal termination.  You can then generate an execution profile using gprof(1).  For separate compile and link steps, if you compile with −pg, then be sure to link with −pg. 

−pic Produce position-independent code.  Each reference to a global datum is generated as a dereference of a pointer in the global offset table.  Each function call is generated in pc-relative addressing mode through a procedure linkage table.  The size of the global offset table is limited to 64K on MC68000-family processors, or to 8K on SPARC processors. 

−PIC Similar to −pic, but allows the global offset table to span the range of 32-bit addresses.  Use it  for those rare cases with too many global data objects for −pic. 

−pipe Use pipes, rather than intermediate files between compilation stages.  Very cpu-intensive. 

−Qoption prog opt
Pass option opt to program prog.  The opt must be appropriate to prog and may begin with a minus sign.  prog can be as, c2, cg, cpp, f77pass1, iropt, inline, ld, optim, or ratfor.  For a Sun-3 or Sun-4, the peephole optimizer file is c2; for a Sun386i, it is optim. 

−Qpath pathname
Insert directory pathname into the compilation search path (to use alternate versions of programs invoked during compilation).  This path will also be searched first for certain relocatable object files that are implicitly referenced by the compiler driver (such files as ∗crt∗.o and bb_link.o ). 

−Qproduce sourcetype
Produce source code of the type sourcetype, where sourcetype can be one of:

.o Object file from as(1). 

.s Assembler source (from f77pass1, inline, c2, cg, or optim). 

For a Sun-3 or Sun-4, the peephole optimizer file is c2; for a Sun386i, it is optim. 

−r4 Treat DOUBLE PRECISION as REAL, and treat DOUBLE COMPLEX as COMPLEX.  Adjusts declared variables.  Note that REAL∗n uses n bytes, regardless. 

−r8 Treat REAL as DOUBLE PRECISION.  (not avialable on the Sun386i) Adjusts declared variables, literal constants, and intrinsic functions.  Sets the default size for REAL, INTEGER, and LOGICAL to 8, for COMPLEX and DOUBLE PRECISION to 16, and for DOUBLE COMPLEX to 32.  If you specify the size, then the default size is not used: for example, with REAL∗n R,
INTEGER∗n I, and COMPLEX∗n Z, the sizes of R, I, and Z are not affected by −r8.  Intrinsic functions are interpreted accordingly.  For example: SQRT is treated as DSQRT.  If you select both -r8 and -i2 , then results are unpredictable.  If you try −r8 on the Sun386i, you get a warning message and command-line processing will continue with the remaining flags. 

−sb SourceBrowser— Produce additional table information for the SourceBrowser. 

−S Compile the named programs, and leave the assembly language output on corresponding files suffixed .s (no .o file is created). 

−temp=dir
Set directory for temporary files to be dir. 

−time Report execution times for the various compilation passes. 

−u Make the default type of a variable ’undefined’, rather than using FORTRAN implicit typing. 

−U Do not convert upper-case letters to lower-case, but leave them in the original case.  The default is to convert upper-case letters to lower-case, except within character-string constants. 

−v Print the name of each pass as the compiler executes. 

−V Print the name and version ID of each pass as the compiler executes. 

−w Suppress all warning messages. 

−w66 Suppress only messages generated by programs using obsolete FORTRAN 66 features. 

−xl[d] Extended Language.  Where source could be either VMS FORTRAN or standard, interpret as VMS FORTRAN .  These ambiguous features are: Unformatted record size in bytes, VMS-style logical file names, quote (") character introducing octal constants, backslash (\) character within character constants, and a nonstandard form of the PARAMETER statement. 

−xld This is for debugging statements: If there is a "D" or "d" in column one, then -xld causes them to be compiled;  otherwise, they’re treated as comments. 

Other arguments are taken to be either linker option arguments, or names of f77-compatible object programs, typically produced by an earlier run, or libraries of f77-compatible routines.  These programs, together with the results of any compilations specified, are linked (in the order given) to produce an executable program in the file specified by the −o option, or in a file named a.out if the −o option is not specified. 

ENVIRONMENT

PATH The f77 command requires that you insert /usr/lang at the beginning of your search path.  This is usually done in the .cshrc file, in a line with set PATH = at the start. 

MANPATH To use the man command for f77 man pages, insert /usr/lang at the beginning of your man path.  This is usually done in the .cshrc file, in a line with set MANPATH = at the start. 

NOTE If you must use LD_LIBRARY_PATH, be sure to put the path /usr/lang/SC0.0 at the start of that path list.  That’s if you installed into the standard, default directory.  But if you installed into a non-default directory such as /your/dir, then insert /your/path /SC0.0 at the start of that path list.  It is safer to avoid this environment variable if you can. 

FILES

a.out executable output file

file.a library of object files

file.d tcov(1) test coverage input file

file.f FORTRAN source file

file.F FORTRAN source file for cpp(1)

file.for FORTRAN source file

file.il inline expansion file

file.o object file

file.r Ratfor source file

file.s assembler source file

file.S assembler source for cpp(1)

file.tcov output from tcov(1)
 

/usr/lang/SC0.0/f3167/libm.a Weitek 3167 math library (Sun386i)

/usr/lang/SC0.0/f3167/libm.il Weitek 3167 math in-line (Sun386i)

/usr/lang/SC0.0/f3167/libm_p.a
Weitek 3167 profiling library (Sun386i)
 

/usr/lang/SC0.0/f68881/libm.a MC68881 math library (Sun-3)

/usr/lang/SC0.0/f68881/libm.il
MC68881 math in-line (Sun-3)

/usr/lang/SC0.0/f68881/libm_p.a
MC68881 profiling library (Sun-3)
 

/usr/lang/SC0.0/f80387/libm.a Intel 80387 math library (Sun386i)

/usr/lang/SC0.0/f80387/libm.il
Intel 80387 math in-line (Sun386i)

/usr/lang/SC0.0/f80387/libm_p.a
Intel 80387 profiling library (Sun386i)
 

/usr/lang/SC0.0/c2 optional peephole optimizer for Sun-3 or Sun-4. 

/usr/lang/SC0.0/cg FORTRAN code generator

/usr/lang/SC0.0/cpp macro preprocessor

/usr/lang/SC0.0/include directory searched by the FORTRAN INCLUDE statement

/usr/lang/SC0.0/include/f77_floatingpoint.h
f77 IEEE arithmetic function type definitions

/usr/lang/SC0.0/include/floatingpoint.h
IEEE arithmetic function type definitions

/usr/lang/SC0.0/include/math.h
math function type definitions
 

/usr/lang/SC0.0/iropt global optimizer
 

/usr/lang/SC0.0/f77 compiler command-line processing driver

/usr/lang/SC0.0/f77pass1 FORTRAN parser
 

/usr/lang/SC0.0/ffpa/libm.a FPA math library (Sun-3)

/usr/lang/SC0.0/ffpa/libm.il FPA math in-line (Sun-3)

/usr/lang/SC0.0/ffpa/libm_p.a
FPA profiling library (Sun-3)
 

/usr/lang/SC0.0/ffpaplus/libm.a
FPA+ math library (Sun-3)

/usr/lang/SC0.0/ffpaplus/libm.il
FPA+ math in-line (Sun-3)

/usr/lang/SC0.0/ffpaplus/libm_p.a
FPA+ profiling library (Sun-3)
 

/usr/lang/SC0.0/fsoft/libm.a software floating-point math library (Sun-3)

/usr/lang/SC0.0/fsoft/libm.il software floating-point math in-line (Sun-3)

/usr/lang/SC0.0/fsoft/libm_p.a
software floating-point profiling library (Sun-3)
 

/usr/lang/SC0.0/fswitch/libm.a
runntime-switched floating-point math library (Sun-3)

/usr/lang/SC0.0/fswitch/libm.il
runntime-switched math in-line (Sun-3)

/usr/lang/SC0.0/fswitch/libm_p.a
runntime-switched profiling library (Sun-3)

/usr/lang/SC0.0/libF77.a FORTRAN library - includes I/O and UNIX interface

/usr/lang/SC0.0/libF77_p.a FORTRAN profiling library

/usr/lang/SC0.0/libF77.so.1.1 FORTRAN shared library
 

/usr/lang/SC0.0/libm.a math library (Sun-4 and Sun386i)

/usr/lang/SC0.0/libm.il math in-line (Sun-4 and Sun386i)

/usr/lang/SC0.0/libm_p.a profiling library (Sun-4 and Sun386i)
 

/usr/lang/SC0.0/libpfc.a startup code for combined Pascal and FORTRAN programs

/usr/lang/SC0.0/libpfc_p.a profiling library for combined Pascal and FORTRAN programs

/usr/lang/SC0.0/libpfc.so.1.1 shared library for combined Pascal and FORTRAN
 

/usr/lang/SC0.0/libV77.a VMS FORTRAN routines that conflict with Sun routines

/usr/lang/SC0.0/libV77_p.a VMS FORTRAN profiling library

/usr/lang/SC0.0/libV77.so.1.1 VMS FORTRAN shared library
 

/usr/lang/SC0.0/misalign/libF77.a
FORTRAN library - I/O and UNIX interface (Sun-4 only)

/usr/lang/SC0.0/misalign/ibF77_p.a
FORTRAN profiling library (Sun-4 only)

/usr/lang/SC0.0/misalign/libF77.so.1.1
FORTRAN shared library (Sun-4 only)

/usr/lang/SC0.0/misalign/libV77.a
VMS routines in conflict with Sun routines (Sun-4 only)

/usr/lang/SC0.0/misalign/libV77_p.a
VMS FORTRAN profiling library (Sun-4 only)

/usr/lang/SC0.0/misalign/libV77.so.1.1
VMS FORTRAN hared library (Sun-4 only)
 

/usr/lang/SC0.0/optim optional peephole optimizer for Sun386i. 
 

/usr/lib/libc.a standard C library, see intro(3)

/usr/lib/libc_p.a profiling library, see intro(3)

/tmp/∗ compiler temporary files

mon.out file produced for analysis by prof(1)

gmon.out file produced for analysis by gprof(1)

SEE ALSO

cc(1),  dbx(1),  fpr(1),  fsplit(1),  gprof(1),  ld(1),  perror(3f),  prof(1),  sbrowser(1),  tcov(1)

Sun FORTRAN User’s Guide

Sun FORTRAN Reference Manual

Sun Numerical Computation Guide

Programming Utilities and Libraries

Sun SourceBrowser Reference Manual
 

DIAGNOSTICS

The diagnostics produced by f77 itself are intended to be self-explanatory.  Occasional messages may be produced by the linker.  The error messages are listed in perror(3f). 

Sun Release 4.1  —  Last change: 02 February 1990

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