F77(1) — USER COMMANDS
NAME
f77 − FORTRAN compiler
SYNOPSIS
f77 [ −386 ] [ −486 ] [ −a ] [ −align _block _ ] [ −ansi ] [ −autopar ] [ −bsdmalloc ]
[ −Bx ] [ −c ] [ −C ] [ −cg89 ] [ −cg92 ] [ −dalign ] [ −depend ] [ −dryrun ]
[ −d[y,n] ] [ −Dname[=def ] ] [ −e ] [ −explicitpar ] [ −f ] [ −fast ] [ −flags ]
[ −fnonstd ] [ −fsimple ] [ −fstore ] [ −F ] [ −g ] [ −G ] [ −h ] [ −help ]
[ −i2 ] [ −i4 ] [ −inline=rlst ] [ −Ipath ] [ −Kpic ] [ −KPIC ]
[ −libmil ] [ −loopinfo ] [ −Ldir ] [ −misalign ] [ −mt ] [ −native ]
[ −noautopar ] [ −nocx ] [ −nodepend ] [ −noexplicitpar ] [ −nofstore ]
[ −nolib ] [ −nolibmil ] [ −noqueue ] [ −noreduction ] [ −norunpath ]
[ −N[cdlnqsx] nnn ] [ −o output ] [ −oldldo ] [ −oldstruct ] [ −onetrip ]
[ −O[n] ] [ −p ] [ −parallel] [ −pentium] [ −pg ] [ −pic ] [ −PIC ] [ −qp ]
[ −Qdir ] [ −Qoption prog opt ] [ −Qpath pathname ] [ −Qproduce typ ] [ −r8 ]
[ −reduction ] [ −R path ] [ −s ] [ −sb ] [ −sbfast ] [ −silent ] [ −stackvar ]
[ −S ] [ −temp=dir ] [ −time ] [ −u ] [ −unroll ] [ −U ] [ −v ] [ −vpara ] [ −V ]
[ −w ] [ −xa ] [ −xcgy ] [ −xF ] [ −xinline=rlst ] [ −xl[d] ] [ −xlibmil ]
[ −xlibmopt ] [ −xlicinfo ] [ −xnolib ] [ −xnolibmil ]
[ −xnolibmopt ] [ −xO[n] ] [ −xpg ] [ −xs ] [ −xsb ] [ −xsbfast ] [ −xtime ]
[ −xunroll ] [ −Xlist ] [ −Zlp ] [ −Ztha ]
source file(s) ... [ −lx ]
DESCRIPTION
f77 is a superset of FORTRAN 77.
Version: FORTRAN 3.0.1 from Sun
Environment: Solaris 1.x/2.x (SunOS 4.x/5.x) or later Purpose: Translate source to an executable (a.out) file
Other Uses:
1. Make an executable for multiple processors, -autopar
2. Do global program checking of source (lint), -Xlist
3. Translate source to relocatable binary (.o) files, -c
4. Translate source to a dynamic library (.so) file, -G
5. Link .o files into an executable file
6. Prepare for debugging, -g
7. Prepare for profiling by statement or procedure, -pg
8. Prepare for profiling by parallelized loop, -Zlp Sample compile of any.f for debugging: f77 −g any.f Note: This is a man page--a quick reference, not a complete reference, not a tutorial.
FILE SUFFIXES
.f Files with names ending in .f or .for are taken to be f77 source files; they are compiled, and each object program is put in the current directory in a file with the same name, with .o substituted for .f or .for.
.for Same as .f files.
.F Files with names ending in .F are also taken to be f77 source files, but they are preprocessed by the C preprocessor (equivalent to a cpp command) before they are compiled by the f77 compiler.
.s Files with names ending in .s are taken to be assembly source files and are assembled, producing .o files.
.il Files with names ending in .il are taken to be inline expansion code template files. The compiler uses these to expand inline 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 inline expansion, be sure to include these .il files in the compile command. You do not need to specify the complete path name of the supplied math library inline templates (the libm.il files) if you use the −fast option. If you want to use your own .il files, then you must specify their complete path on the compile line.
OPTIONS
See ld(1) for link-time options.
−386 (x86 only) Code generator. Generate code that exploits features available on Intel 80386 compatible processors. The default is −386.
−486 (x86 only) Code generator. Generate code that exploits features available on Intel 80486 compatible processors. The default is −386. Code compiled with -486 does run on 80386 hardware, but it may run slightly slower.
−a Profile by basic block. Count how often each basic block is executed. Run tcov(1) on the source file to generate statistics about the program. For separate compile and link steps, if you compile with −a, then link with −a. You can mix −a with −O.
−align _ block _ (SPARC only)
Solaris2.x: This is for compatibility with older releases. It is recognized, so it does not break make files. It does nothing. Solaris 1.x: 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 ld and is not used by f77.
−ansi Identify many non-ANSI extensions.
−autopar (Solaris 2.x, SPARC only) Automatic parallelization. Find and parallelize appropriate loops. Do dependence analysis (analyze loops for inter-iteration data dependencies). Do loop restructuring. If optimization is not −O3 or higher, it is raised to −O3. −autopar conflicts with −g. Avoid −autopar if you do your own thread management. See note under −mt. Example: f77 −autopar any.f This option requires the iMPact FORTRAN MP package. To get faster code, use this option on a multiprocessor system. On a single-processor system the generated code usually runs slower. Risk: Do not use automatic parallelization without reading the appendixes "iMPact: Multiple Processors" and "iMPact: Automatic Parallelization," in the FORTRAN User’s Guide. Number of processors: To request more than one processor, set the PARALLEL environment variable. If N is the number of processors available on the machine, then for a one-user, multiprocessor machine, try PARALLEL=N−1. Risk: If one user alone asks (or all users together ask) for more processors than are available on the machine, there can be serious degradation of performance. Read the FORTRAN User’s Guide, Section C.4, "Number of Processors." If −autopar is specified but −explicitpar is not, then explicit parallelization directives (such as c$par doall) are ignored. If you use −autopar and compile and link in one step, then linking automatically includes the microtasking library and the threads-safe FORTRAN runtime library. If you use −autopar and compile and link in separate steps, then you must also link with −autopar.
−bsdmalloc (SunOS 4.1.2 and 4.1.3 only)
Faster malloc. Use the faster malloc from the the library libbsdmalloc.a. This malloc is faster but less memory efficient. This option passes the following to the linker:
−u _malloc /lib/libbsdmalloc.a
−B[x] Dynamic or static binding for libraries.
The default is dynamic. Linker option.
−Bdynamic: Dynamically bound (shared libraries)
−Bstatic : Statically bound (nonshared libraries)
−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 Check subscripts. Check for any subscript being outside the declared or assumed bounds for that subscript. This helps catch some causes of the dreaded segmentation fault.
−cg89 (SPARC only) Generate code to run on generic SPARC architecture. Use a subset of the SPARC V8 instruction set. With −cg89 and optimization, the instructions are scheduled for faster executables on a generic SPARC machine. Code compiled −cg89 does run on −cg92 hardware.
−cg92 (SPARC only) Generate code to run on SPARC V8 architecture. Allow the use of the full SPARC V8 instruction set. In particular, allow the following instructions to be generated in-line: smul, smulcc, sdiv, sdivcc, umul, umulcc, udiv, udivcc, fsmuld With −cg92 and optimization, the instructions are scheduled for faster executables on a SuperSPARC machine. Code compiled with −cg92 does run on older machines, but it may run slowly, as the new instructions added to SPARC V8 are emulated by traps to the operating system. General Comments o SPARC: default code generation is −cg89
o OK if both −cg89 and -cg92 routines in a.out
o fpversion (1) tells which to use: −cg89, −cg92
It may take about a minute to start the report.
o 1.x only: There was a −cg87; it is gone.
See fpversion(1) for replacement.
−dalign (SPARC only) Double align. Allow f77 to use double load/store. Generate double load store instructions wherever possible for faster execution. Using this option automatically triggers the −f option, which causes all double-precision and quadruple-precision data types (both real and complex) 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 subprogram with −dalign, compile all subprograms of the program with −dalign. −dalign is unsuitable for subprograms that access double-precision data that is not aligned on 8-byte boundaries; unexpected bus errors may occur.
−depend Dependence analysis. Analyze loops for inter-iteration data dependencies and do loop restructuring. Dependence analysis is included in −autopar. The dependence analysis is done at compile time. The −depend option is ignored unless either −O3 or −O4 is on, explicitly, or by another option. At runtime, it usually runs faster on multiple-processor systems with PARALLEL≥2. It can run slower for single processor systems; To get it to run faster for single-processor systems, do not use either −autopar or −explicitpar.
−dryrun Show but do not execute commands constructed by the compiler.
−d[y,n] (Solaris 2.x only) Do dynamic binding of the executable file: y(es) or n(o). The default is dynamic . This is a linker option.
−dy: Dynamically bound (shared libraries)
−dn: Statically bound (nonshared libraries)
−Dname[=def ]
Define symbol name to C preprocessor, cpp(1). Equivalent to a “#define” directive in the source. If no def is given, name is defined as “1”.
This option applies to .F suffix files only.
The following values are predefined on appropriate systems (Note the 2 leading underscores):
__sparc, __unix, __sun, __i386, __SVR4
They can be in such preprocessor conditionals as
#ifdef __sparc
Corresponding older values (prior releases) are:
sparc, unix, sun, i386
These earlier predefined values may be deleted in a future release.
−e Extend the source line maximum length to 132 characters.
−explicitpar
(Solaris 2.x, SPARC only) Explicit parallelization. Parallelize loops that the programmer specified. You (rather than the compiler) analyze loops for inter-iteration data dependencies, and you (rather than the compiler) specify which loops are safe to parallelize. The −explicitpar option by itself does not automatically do data dependence analysis. If optimization is not at −O3 or higher, then it is raised to −O3.
−explicitpar conflicts with −g. Avoid −explicitpar if you do your own thread management. See −mt. The −explicitpar option requires the iMPact FORTRAN MP package. To get faster code, use this option on a multiprocessor system. On a single-processor system the generated code usually runs slower. Risk: Do not use explicit parallelization without reading the appendixes "iMPact: Multiple Processors", "iMPact: Automatic Parallelization," and and "iMPact: Explicit Parallelization," in the FORTRAN User’s Guide. If you identify a loop for parallelization, and the loop has dependencies, you can get incorrect results, possibly different ones with each run, and with no warnings. Do not apply an explicit parallel pragma to a reduction loop. The explicit parallelization is done, but the reduction aspect of the loop is not done, and the results can be incorrect. If you use −explicitpar and compile and link in one step, then linking automatically includes the microtasking library and the threads-safe FORTRAN runtime library. If you use −explicitpar and compile and link in separate steps, then you must also link with −explicitpar.
−f (SPARC only) Force 8-byte boundaries. Align all common blocks and all double-precision and quadruple-precision local data on 8-byte boundaries. This applies to both real and complex data. Resulting code may not be standard and may not be portable. If you compile one subprogram with −f, compile all subprograms of the program with −f.
−fast Fast execution. 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 −O4 combination. If you combine −fast with other options, the last specification applies.
Even though the optimization for −fast is −O3, the optimization part of −fast −O4 is −O4. If you do not specify the level (as in −fast −O) you get −fast −O3. It is a convenience option, and it chooses:
o Fastest code generation option available on
compile-time hardware (SPARC: −cg89, −cg92)
o Optimization level ( −O3),
o A set of inline expansion templates,
o The −fnonstd floating-point option,
o The −fsimple option,
o The −dalign option (SPARC only),
o The −xlibmopt option (SPARC only). For x86 the −fast option turns off the −fstore option. For detail on the constituents of −fast , read the User’s Guide . 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.
For separate compile and link steps: if you compile with −fast, then be sure to link with −fast.
−flags Synonym for −help.
−fnonstd Do nonstandard initialization of floating-point arithmetic hardware:
o Abort on exceptions
o Flush denormalized numbers to zero if it will improve speed
For denormalized number, see −fnonstd, in the
FORTRAN User’s Guide. See the Numerical Computations Guide for even more on denormalized numbers. The standard initialization of floating-point is the default:
o IEEE 754 floating-point arithmetic is nonstop
o Underflows are gradual
Specifying −fnonstd during the link step is like having the following at the start of a main.
i = ieee_handler ("set", "common", SIGFPE_ABORT)
CALL nonstandard_arithmetic()
The nonstandard_arithmetic() call turns on the NS bit of the %fsr. On some SPARC processors this makes underflow handling faster: underflows always produce zero rather than a possibly subnormal number, as the IEEE standard requires. On other SPARC processors the NS bit may have a different effect or no effect.
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), ieee_functions(3m), the Numerical Computations Guide, and SPARC Architecture Manual Version 8.
−fsimple Simple floating-point model. Allow optimization using mathematically equivalent expressions. The optimizer is allowed to act as if a simple floating-point model holds during compilation and runtime. It is allowed to optimize without regard to roundoff or numerical exceptions.
That is, with −fsimple, the optimizer can assume the following:
o IEEE 754 default rounding/trapping modes hold.
o No exceptions arise other than inexact.
o The code does not test for inexact exceptions.
o There are no infinities or NaNs.
o The code does not depend on sign of zero.
−fstore Force floating-point expressions to precision of destination variable (x86 only). This applies to assignment statements.
Default (unless −fast is on): −fstore.
−F Apply the CPP preprocessor to files with the .F suffix and put the result in the file with the suffix changed to .f, but do not compile.
−g Debug. Produce additional symbol table information for dbx(1) or debugger(1). For separate compile and link steps: if you compile with −g , then link with −g . −autopar, −explicitpar, and −parallel conflict with −g. The −g is turned off. The −g no longer overrides −O, but it does override the automatic in-lining usually provided by −O4.
−G (Solaris 2.x only) Build a shared library.
Tell the linker to make a shared dynamic library.
−h name (Solaris 2.x only) Name a shared library.
The −hname option assigns a name to a shared dynamic library. This provides a way to have versions of a shared dynamic library. In general, the name after −h should be exactly what you have after the −o. The space between the −h and name is optional. −hname is a loader option. The compile-time loader assigns the specified name to the shared dynamic library being created, and it records the name in the library file as the internal name of the library. If there is no −hname option, then no internal name is recorded in the library file. Every executable file has a list of needed shared library files. When the runtime linker links the library into an executable file, the linker copies the internal name from the library into that list of needed shared library files.
If there is no internal name of a shared library, then the linker copies the path of the shared library file instead.
−help Display an equivalent of this list of options and show how to send feedback comments to Sun.
−i2 Integers, short. Make 2 the default size in bytes for integer and logical constants and variables. But for INTEGER∗n Y, the Y uses n bytes, regardless of −i2
−i4 Integers, standard. Make 4 the default size in bytes for integer and logical constants and variables. But for INTEGER∗n Y, the Y uses n bytes, regardless of the −i4 option.
−inline=rlst
Inline the specified user-written routines. Optimize by inlining the specified user-written routines named in the list rlst. The list is a comma-separated list of functions and subroutines. Only routines in the file being compiled are considered. The optimizer decides which of these routines are appropriate for inlining. If compiling with −O3, this can increase optimization by inlining some routines. The −O3 option inlines none by itself. If compiling with −O4, this can decrease optimization by restricting inlining to only those routines in the list. With −O4, the optimizer normally tries to inline all appropriate user-written subroutines and functions.
A routine is not inlined if any of the following apply (no warnings):
o Optimization is less than −O3
o The routine cannot be found
o Inlining it is not profitable or safe
o The source is not in the file being compiled
−Ipath Include path. Insert path at the beginning of the list of directories in which to search for preprocessor #include files.
Example: “f77 −I/usr/applib growth.F”
searches for #include files in the /usr/applib directory. The path and directory list in the −Ipath option is for #include files with relative path names, not absolute path names. This option applies only to source files with a .F suffix. Note that this does not affect the FORTRAN INCLUDE statement, only the C preprocessor #include directive. Search order for the #include files:
1. The directory containing the source file
2. Directories named in −I options
3. Directories in the default list.
Default list depends on Solaris and installation:
Solaris 1.x
Standard install: /usr/lang/SC3.0.1/include/f77 /usr/include
Nonstandard install to /my/dir/:
/my/dir/SC3.0.1/include/f77 /usr/include
Solaris 2.x
Standard install:
/opt/SUNWspro/SC3.0.1/include/f77 /usr/include
Nonstandard install to /my/dir/:
/my/dir/SC3.0.1/include/f77 /usr/include
−Kpic Synonym for −pic
−KPIC Synonym for −PIC
−libmil Inline templates. Select the most appropriate inline templates for the floating-point option and operating system release available on this system.
−loopinfo Loop information. (Solaris 2.x, SPARC only)
Show which loops are parallelized and which are not. This is normally for use with the −autopar and −explicitpar options. It does require the FORTRAN MP package.
−lx Link with library libx.a. Direct the loader to link with object library libx.a, where x is a string. See ld(1). Example: −lV77 links in the library libV77.a VMS Routines in libV77: You get most of the VMS library routines automatically (without any special command-line option). The library libV77.a has those VMS emulation routines that are in conflict with standard UNIX usage, plus a few others. If you use −lV77, you get VMS compatible versions of date, idate, and time. See the FORTRAN Reference Manual for details. Order on the Command Line: Place −lx options after any .f, .F, or .o files. If you call functions in libx, and they reference functions in liby, then place −lx before −ly. Search Order for −lx files. The linker searches for libraries in several locations. For details, see Chapter 7 "Creating and Using Libraries," in the FORTRAN User’s Guide. See also ld(1).
−Ldir Library directory. Add dir at the start of the list of directories for library routines (linking using ld(1)).
Risk: Do not use the −Ldir option to specify /usr/lib or /usr/ccs/lib, since they are searched by default, and including them here prevents using the unbundled libm.
−misalign (SPARC only) Misaligned data. 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. SLOW: With −misalign, f77 generates much slower code for references to dummy arguments. If you can, you should recode the indicated section instead of recompiling with this option. Example: −misalign
INTEGER∗2 I(4)
REAL R1, R2
EQUIVALENCE (R1, I(1)), (R2, I(2))
END
The above shows the following error message.
"misalign.f", line 4: Error: bad alignment for "r2"
forced by equivalence
For separate compile and link steps: if you compile with −misalign, then link with −misalign.
−mt (Solaris 2.x, SPARC only) Use multithread safe libraries. If you are doing your own multithread coding (not using the −autopar, −explicitpar, or −parallel, options) then you must use the −mt option in the compile and link steps. The parallelization options use −mt automatically. The −mt option requires the iMPact FORTRAN MP package. To get faster code, this option requires a multiprocessor system. On a single-processor system the generated code usually runs slower with this option.
−native Native floating-point. Generate code for the most appropriate floating-point hardware available on the machine you are using to compile. For separate compile and link steps: if you compile with −native, then be sure to link with −native.
−noautopar
(Solaris 2.x, SPARC only) Do not parallelize loops automatically. This option requires the iMPact FORTRAN MP package.
−nocx (Solaris 1.x only) Smaller executable file, by about 128K bytes. It does this by not linking with -lcx. However, the runtime performance and accuracy of binary-decimal base-conversion will be somewhat compromised.
−nodepend (SPARC only) Cancel any −depend that appears earlier on the command line.
−noexplicitpar
(Solaris 2.x, SPARC only) Do not parallelize loops explicitly. This option requires the iMPact FORTRAN MP package.
−nofstore (x86 only) Do not force expressions to have the precision of the destination variable. This applies to assignment statements only.
Default if −fast is on: −nofstore.
−nolib Do not automatically link with any system or language library; that is do not pass any −lx options on to ld. The default is to link such libraries into the executables automatically, without the user specifying them on the command line. The system and language libraries are required for final execution. It is the users responsibility to link them in manually. This provides complete control (and with control comes responsibility) for the user. The −nolib option makes it easier to link one of these libraries statically. For example, an application linked dynamically with libF77 fails on a machine that has no libF77. You can avoid such failure by shipping libF77 to your customer, or by linking it statically.
Example: Link libF77 statically, libc dynamically
f77 −nolib any.f −Bstatic −lF77 −Bdynamic −lm −lc
There is no dynamic libm; it is always linked statically. Order for −lx options is important. Use the order shown in the example.
−nolibmil Reset −fast so that it does not include inline templates. Use this after the −fast option:
f77 −fast −nolibmil ...
−noqueue No license queue. If you use this option and no license is available, the compiler returns without queuing your request and without doing your compile. A nonzero status is returned for testing in make files.
−noreduction
(Solaris 2.x, SPARC only) Do no reduction. This option requires the iMPact FORTRAN MP package.
−norunpath
(Solaris 2.x only) No run path in executable. If an executable file uses shared libraries, then the compiler normally builds in a path that tells the runtime linker where to find those shared libraries. The path depends on the directory where you installed the compiler. The −norunpath option prevents that path from being built in to the executable. This option is helpful if you have installed in some nonstandard location, and you ship an executable file to your customers, but you do not want to make the customers deal with that nonstandard location.
−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 25.
−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 99 (1 initial and 99 continuation).
−Nn Maximum number of identifiers. This option has no effect. The number of identifiers is now unlimited. This option is still recognized so it does not break make files, but it may be deleted in a future release.
−Nq Maximum number of equivalenced variables. The default is 500.
−Ns Maximum number of statement numbers. The default is 2000.
−Nx Maximum number of external names (common block names, subroutine and function names). The default is 1000.
−o outfil Name final output file outfil instead of a.out.
−oldldo Old list-directed output. Omit the blank that starts each record for list-directed output. This is a change from releases 1.4 and earlier. The default behavior is to provide that blank, since the FORTRAN Standard requires it. This is a compile option; that is, each .o file could have its own −oldldo option. See also the FORM=’PRINT’ option of OPEN.
−oldstruct Align structures as in releases 1.4 and earlier. Use this to read unformatted files created with these older versions of f77, which is different from the default way and the VMS way. If you use −oldstruct and −xl, then you get −oldstruct.
−onetrip Compile DO loops so they are performed at least once if reached. f77 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[n] Optimize the object code for speed of execution. The −g option no longer suppresses −On.
Note: If −O[n] is not specified, the compiler still performs a default level of optimization; that is, it executes a single iteration of local common subexpression elimination and live/dead analysis.
−O Optimize at the level most likely to give close to the maximum performance for most realistic applications (currently −O3).
−O1 Do only the minimum amount of optimization (peephole). This is postpass assembly-level optimization.
−O2 Do basic local and global optimization. This level usually gives minimum code size. The details are: induction variable elimination, local and global common subexpression elimination, algebraic simplification, copy propagation, constant propagation, loop-invariant optimization, register allocation, basic block merging, tail recursion elimination, dead code elimination, tail call elimination, and complex expression expansion. Do not use −O2 unless −O3 results in excessive compilation time, running out of swap space, or excessively large code size.
−O3 Besides what −O2 does, this optimizes references and definitions of external variables.
−O4 Besides what −O3 does, this does automatic in-lining of functions in the same file. Code usually runs faster, but for some codes, −O4 make them run slower. −g suppresses automatic in-lining. In general, −O4 results in larger code. For SPARC only: If the optimizer runs out of memory, it tries to recover by retrying the current procedure at a lower level of optimization and resumes subsequent procedures at the original level specified in the command-line option.
−p Profile by procedure. Prepare object files for profiling with prof(1). This makes 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.
−parallel
(Solaris 2.x, SPARC only) Parallelize both automatic and explicit loops. This option invokes −autopar, −depend, and −explicitpar. There is still a risk of producing incorrect results.
−parallel conflicts with −g.
Example: f77 −parallel any.f Avoid −parallel if you do your own thread management. See −mt.
Risk: Do not use parallelization without reading the appendixes "iMPact: Multiple Processors," "iMPact: Automatic Parallelization," and "iMPact: Explicit Parallelization," in the FORTRAN User’s Guide. This option requires the iMPact FORTRAN MP package. To get faster code, use this option on a multiprocessor SPARC system. On a single-processor system the generated code usually runs slower. The −autopar option (and therefore the −parallel option) includes dependence analysis; that is, if you try a −autopar both with and without −depend, there is no observable difference. If you compile and link in one step, then −parallel links with the microtasking library and the threads-safe FORTRAN runtime library. If you compile and link in separate steps, and you compile with −parallel, then link with −parallel.
−pentium
(x86 only) Generate code that exploits features available on Intel Pentium compatible computers. Default: −386.
−pg Profile by Procedure. Prepare the object files for profiling with gprof(1). This makes 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 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.
For SPARC only, With −pic:
(1) Size of global offset table limited to 8K
(2) In any one program, use all −pic or all −PIC
−PIC (SPARC only) 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. For any one program, use all −pic or all −PIC.
−qp Synonym for −p.
−Qdir Synonym for −Qpath.
−Qoption prog oplis
Pass option list oplis to the program prog. The list is a comma-separated list of options, no blanks within the list. Each option must be appropriate to prog and may begin with a minus sign. prog can be as, fbe, cg, cpp, f77pass1, iropt, ld, or ratfor.
For Solaris 2.x, the assembler used by the compiler is fbe. For Solaris 1.x, it is as. Example: Load Map.
Solaris 1.x. f77 −Qoption ld −M any.f
Solaris 2.x. f77 −Qoption ld −m any.f
−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 typ
Produce code of type typ, where typ can be one of:
.o Object file from as(1).
.s Assembler source (from f77pass1 or cg).
−r8 Interpret REAL as DOUBLE PRECISION, interpret COMPLEX as DOUBLE COMPLEX, and so forth. This adjusts declared variables, literal constants, and intrinsic functions. As an intrinsic function example: SQRT is treated as DSQRT. This sets the default size for REAL, INTEGER, and LOGICAL to 8, and for COMPLEX to 16. For INTEGER and LOGICAL the compiler allocates 8 bytes, but does only 4-byte arithmetic.
(SPARC only): This also sets the default size for 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, LOGICAL∗n L, and COMPLEX∗n Z, the sizes of R, I, L, and Z are not affected by −r8. In general, if you compile a subprogram with −r8, then compile all subprograms of that program with −r8. If you select both −r8 and −i2, the results are unpredictable.
−reduction (Solaris 2.x, SPARC only)
Reduction Loops. Analyze loops for reduction in automatic parallelization. To enable parallelization of reduction loops, specify
both −reduction and −autopar.
If you specify −reduction without −autopar, the compiler issues a warning. Before you use reduction, see the FORTRAN User’s Guide, especially the appendix "iMPact: Automatic Parallelization." This option requires the iMPact FORTRAN MP package. To get faster code, this option requires a multiprocessor system. On a single-processor system the generated code usually runs slower. Example: f77 −autopar −reduction any.f There is always potential for roundoff error with reduction. Use: If you have a reduction loop to be parallelized, then use −reduction (with −autopar, of course). Do not use an explicit pragma, because the explicit pragma prevents reduction for that loop, resulting in wrong answers.
−R list (Solaris 2.x only) Library paths. Store a list of library search paths into the output object file and pass the list to the runtime linker, ld(1). list is a colon-separated list of directories used to specify library search paths to the runtime linker. The blank between −R and list is optional. If both LD_RUN_PATH and the −R option are specified, the libraries in the −R list are stored and those in LD_RUN_PATH are ignored.
Multiple instances of this option are concatenated together with each list being separated by a colon.
Use: Use this if you want to ship an executable that your users can run without any special option for paths to your dynamic libraries.
−s Strip the executable file of its symbol table.
−sb Produce table information for the SourceBrowser.
−sbfast Produce only table information for the SourceBrowser and stop. Do not assemble, link, etc. Do not make object files.
−silent Prompt only. While compiling, if there are no warnings or errors, then display only the prompt. The default is to display the entry names and the file names.
−stackvar
Use the stack to allocate all local variables in a subprogram unless otherwise specified. This is equivalent to declaring them to be automatic. Do not use this option if the subprogram uses EQUIVALENCE, NAMELIST, STRUCTURE, or RECORD, as you will get a compilation error. This option gives more freedom to the optimizer for such tasks as parallelizing.
−S Assembly Source. Compile the named programs and leave the assembly language output on corresponding files suffixed .s (no .o file is created).
−temp=dir
Directory for temporary files. Set directory for temporary files used by f77 to be dir instead of /tmp/.
−time Execution times. Report execution times for the various compilation passes.
−u Undefined variables. Make the default type of variables undefined rather than using FORTRAN implicit typing. This does not override any IMPLICIT statements or explicit type statements.
−unroll=n Unroll loops. Direct the optimizer on unrolling loops n times.
n is a positive integer.
If n = 1, the compiler unrolls no loops.
If n > 1, this suggests to the compiler that it unroll loops n times.
If any loops are actually unrolled, then the executable file is larger.
−U Upper-case as is. For identifiers, 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 Verbose. Print the name of each pass as the compiler executes, plus display in detail options and environment variables used by the driver.
−vpara Verbose parallelization warnings. As the compiler detects each explicitly parallelized loop that has dependencies, it issues a warning message but the loop is parallelized. Use with −explicitpar and a "c$par doall" parallel pragma. This option requires the iMPact FORTRAN MP package.
Example: f77 −explicitpar −vpara any.f
−V Print the name and version ID of each pass as the compiler executes.
−w Suppress warning messages. This suppresses most warnings. However, if you specify two options and the second one overrides all or part of the first one, you do get a warning.
Example: f77 −fast −O4 any.f
−xa Synonym for −a.
−xcg[89,92]
Synonym for −cg[89,92] .
−xinline=rl
Synonym for −inline=rl.
−xF (Solaris 2.x only) Function-level reordering. Enable performance analysis of the executable using the SPARCworks Analyzer and Debugger (see analyzer(1) and debugger(1) man pages). This option also causes the assembler to generate some debugging information (in the object file) necessary for data collection. Generate code that can be reordered at the function level. This places each function from the file and into a separate section. Example: Functions fcn1() and fcn2() are placed in the sections .text%fcn1 and .text%fcn2. You can control the order of functions in the final executable by using this −xF option and the loader −Mmapfile option. Within the map file, if you include the flag O (that’s an oh, for order, not a zero) in the string of segment flags, then the static linker ld will attempt to place sections in the order they appear in the map file. See Linker and Libraries Manual for more on this option, segment flags, and map files.
−xl[d] Extended Language. You get most of the VMS FORTRAN features automatically, with no special option needed. But where the same source code can mean two different behaviors (one behavior for VMS FORTRAN and another behavior for f77, the −xl makes the compiler choose VMS FORTRAN .
These VMS −xl features are:
Unformatted record size in words not bytes,
VMS-style logical file names,
Quote (") character introducing octal constants,
Backslash (\) as ordinary normal in constants,
A nonstandard form of the PARAMETER statement,
Alignment of structures as in VMS FORTRAN.
−xld Besides what −xl does, this allows VMS 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.
−xlibmil Synonym for −libmil.
−xlibmopt (SPARC only) Use a library of selected math routines optimized for performance. This usually generates faster code. It may produce slightly different results; if so, they usually differ in the last bit. The order on the command line for this library option is not significant.
−xlicinfo License information. Return license information about the licensing system. In particular, return the name of the license server and the user IDs of users who have licenses checked out. Generally, with this option no compilation is done and a license is not checked out. If a conflicting option is used, then the latest one on the command line wins and there is a warning.
Example: f77 −c −xlicinfo any.f does no compilation and reports license information.
Example: f77 −xlicinfo −c any.f does compilation and does not report license information.
−xnolib Synonym for −nolib.
−xnolibmil
Synonym for −nolibmil.
−xnolibmopt
(SPARC only) Reset −fast so that it does not use the library of selected math routines optimized for performance. Use this after the −fast option:
f77 −fast −xnolibmopt ...
−xO[n] Synonym for −O[n].
−xpg Synonym for −pg.
−xs Symbol Tables for dbx. Revert to implementing symbol tables as implemented in release 1.4 and earlier. For this older way, if you move the executables, you must also move the source files, but you do not need to move the object files. Also, the loader links more slowly and dbx initializes more slowly. For comparison, with the newer way, which is now the default, the loader links faster and dbx initializes faster. If you move the executables, you must move both the source files and the object ( .o ) files. This option passes the −s option to the assembler, which does the above action.
−xsb Synonym for −sb.
−xsbfast Synonym for −sbfast.
−xtime Synonym for −time.
−xunroll=n
Synonym for −unroll=n
−Xlist Global program checking. Check across routines for consistency. This helps find a variety of bugs. In general, −Xlist also make a line-numbered listing of the source and a cross reference table of the identifiers. The errors found do not prevent the program from being compiled and linked. Output is to a file with a name like the first file name but with a .lst extension. For example, f77 −Xlist file1.f file2.f file3.f puts the errors, listing, and cross-reference table onto the file file1.lst.
−Zlp (Solaris 2.x, SPARC only) Loop profiling. Prepare object files for the loop profiler looptool. The −Zlp option requires the iMPact FORTRAN MP package. If you compile and link in separate steps, and you compile with −Zlp, then be sure to link with −Zlp. If you compile one subprogram with −Zlp, you need not compile all subprograms of that program with −Zlp. However, you get loop information only for the files compiled with −Zlp, and no indication that the program includes other files.
−Ztha (Solaris 2.x, SPARC only) Prepare object files for analysis by the Thread Analyzer. It inserts calls to a profiling library at all procedure entries and exits. Code compiled with -Ztha links with the library libtha.so. The −Ztha option requires the iMPact FORTRAN MP package. If you compile and link in separate steps, and you compile with −Ztha, then link with −Ztha. If you compile a subprogram with −Ztha, you need not compile all subprograms of that program with −Ztha. However, you get thread statistics only for the files compiled with −Ztha, and no indication that the program includes other files. Refer to tha(1), or the Thread Analyzer User’s Guide for more information.
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 routines that are f77-compatible. 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 Before using f77, change your search path.
For csh, this is usually done in the .cshrc file, in a line that starts with set PATH = Put the following at the start of the search path:
| Standard Install | Nonstandard Install to /my/dir/ | |
| Solaris 1.x | /usr/lang/ | /my/dir/ |
| Solaris 2.x | /opt/SUNWspro/ | /my/dir/SUNWspro/ |
MANPATH
Before using f77 man pages, set MANPATH.
For csh, this is usually done in the .cshrc file, in a line with set MANPATH = at the start. Put the following near the start of MANPATH:
| Standard Install | Nonstandard Install to /my/dir/ | |
| Solaris 1.x | /usr/lang/man/ | /my/dir/man/ |
| Solaris 2.x | /opt/SUNWspro/man/ | /my/dir/SUNWspro/man/ |
LD_LIBRARY_PATH
If you set LD_LIBRARY_PATH, set it as follows:
| Standard Install | Nonstandard Install to /my/dir/ | |
| Solaris 1.x | /usr/lang/SC3.0.1 | /my/dir/SC3.0.1/ |
| Solaris 2.x | /opt/SUNWspro/SC3.0.1/ | /my/dir/SUNWspro/SC3.0.1/ |
The ‘3.0.1’ part varies with the release of the set of compilers.
LD_RUN_PATH
If you use LD_RUN_PATH, note that for f77, LD_RUN_PATH is not identical with −R. (For ld.so, they are identical.) See −R, in the FORTRAN User’s Guide, for details.
FILES
Selected major files used by the compiler
a.out Executable output file
file.a Library of object files
file.d Test coverage input file for tcov(1)
file.f FORTRAN source file
file.F FORTRAN source file for cpp(1)
file.for FORTRAN source file
file.il In-line 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/lib/libc.a Standard C library, see intro(3)
/usr/lib/libp/libc.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)
For the remaining files, if no path is shown then they are in the following directory:
| Standard Install | Nonstandard Install to /my/dir/ | |
| Solaris 1.x | /usr/lang/SC3.0.1 | /my/dir/SC3.0.1/ |
| Solaris 2.x | /opt/SUNWspro/SC3.0.1/ | /my/dir/SUNWspro/SC3.0.1/ |
The ‘3.0.1’ varies with the release of the compilers.
cg
Code generator
cpp Macro preprocessor
include/f77 Path searched for f77 INCLUDE statement
include/f77/f77_floatingpoint.h
f77 IEEE arithmetic type definitions
iropt Global optimizer
f77 Compiler command-line processing driver
f77pass0 Global program checker
f77pass1 Parser
libF77.a f77 lib, includes I/O & UNIX interface
libF77_p.a f77 profile lib (1.x)
libp/libF77.a f77 profile lib (2.x)
libm.a Math lib (1.x)
/usr/lib/libm.a Math lib (2.x)
libm_p.a Math profile lib (1.x)
/usr/lib/libp/libm.a Math profile lib (2.x)
libsunmath.a Sun Value-added math lib
libsunmath_p.a Sun Value-added math profile lib (1.x)
libp/libsunmath.a Sun Value-added math profile lib (2.x)
libpfc.a Startup, mixed Pascal, f77
libpfc_p.a Profile lib, mixed Pascal, f77 (1.x)
libp/libpfc.a Profile lib, mixed Pascal, f77 (2.x)
libV77.a VMS routines in conflict with Sun f77
libV77_p.a VMS FORTRAN profile lib (1.x)
libp/libV77.a VMS FORTRAN profile lib (2.x)
SEE ALSO
asa(1), cc(1), dbx(1), fpr(1), fsplit(1), gprof(1), ld(1), perror(3f), prof(1), tcov(1)
FORTRAN User’s Guide
FORTRAN Reference Manual
Numerical Computation Guide
Programming Utilities
Debugging a Program
Profiling Tools
Programming Libraries
Linker and Libraries Manual The FORTRAN User’s Guide has more details and examples on:
Operating Environments
New or Changed Features with this Release
Compatibility
Options
Making and Using Libraries
Floating Point
Debugging
Global Program Checking Across Routines
Porting
Profiling and Performance Tuning
C-FORTRAN Interface
iMPact: Parallelizing Programs for Multiple Processors
The FORTRAN Reference Manual has details and examples on:
Data Types
Statements
I/O
Functions and Subroutines
VMS Features
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).
See also the FORTRAN User´s Guide and the FORTRAN Reference Manual .
Sun Release 4.1 — Last change: 15 July 1994