F77(1)

NAME

f77 - FORTRAN compiler

SYNOPSIS

f77 [ -66 ] [ -a ] [ -align _block _ ] [ -ansi ] [ -bsdmalloc ] [ -B[dynamic,static] ] [ -c ] [ -C ] [ -cg[87,89,92] ] [ -dalign ] [ -dryrun ] [ -d[y,n] ] [ -Dname[=def ] ] [ -e ] [ -f ] [ -fast ] [ -fnonstd ] [ -F ] [ -g ] [ -G ] [ -h ] [ -help ] [ -i2 ] [ -i4 ] [ -Ipath ] [ -libmil ] [ -Ldir ] [ -misalign ] [ -native ] [ -nolib ] [ -nolibmil ] [ -noqueue ] [ -N[cdlnqsx] nnn ] [ -o output ] [ -oldldo ] [ -oldstruct ] [ -onetrip ] [ -O[1234] ] [ -p ] [ -pg ] [ -pic ] [ -PIC ] [ -Qoption prog opt ] [ -Qpath pathname ] [ -Qproduce sourcetype ] [ -r4 ] [ -r8 ] [ -R path ] [ -sb ] [ -sbfast ] [ -silent ] [ -S ] [ -temp=dir ] [ -time ] [ -u ] [ -U ] [ -v ] [ -V ] [ -w66 ] [ -w ] [ -xF ] [ -xlicinfo ] [ -xl[d] ] [ -xs ] [ -Xlist ] source file(s) ... [ -lx ]

DESCRIPTION

Example: Compile the any.f source file with the option for debugging.

Purpose: f77 is SPARCompiler FORTRAN from SunPro. This is release 2.0.1, which runs in the Solaris 2.0 (uses SunOS 5.0) and Solaris 1.x (uses SunOS 4.1.x) operating environments. f77 translates from programs written in f77 source code to executable load modules, or to relocatable binaries for linking by ld (1), or to dynamic shared libraries. f77 is a superset of FORTRAN 77, with many extensions, including compatibility with VMS FORTRAN .

File Suffixes

.f and .for : 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 as the source, with .o substituted for the .f or .for .

.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 /lib/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 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 do not need to specify the complete path name of the supplied math library in-line 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.
  • -66 Report non-FORTRAN 66 constructs as errors. This option may be deleted in a future release.
  • -a Insert code to count how many times each basic block is executed. -a invokes a runtime recorder that creates a .d file for each .f file (at normal termination). The .d file accumulates execution data for the corresponding source file. You can then run tcov (1) on the source file to generate statistics about the program. For separate compile and link steps, if you compile with -a , be sure to link with -a . You can mix -a with -O ; in some earlier versions, -a overrode -O .
  • -align _ block _ SunOS 5.0 : This option is provided for compatibility with older releases. It is recognized, so it does not break make files. It does nothing .

    SunOS 4.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.
  • -bsdmalloc SunOS 4.1.x only : Faster malloc. Use the faster malloc from the the library libbsdmalloc.a . This malloc is faster but less memory efficient. This option causes the flags
  • -B[dynamic,static] Use dynamic or static binding. The default is dynamic . A linker option.
  • -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. This helps catch some causes of the dread segmentation fault.
  • -cg[87,89,92] Code generation for floating-point hardware. Generate code for Sun-4 systems released in one of the years 1987, 1989, or 1992, and later. 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. If you compile any procedure of a program or library with one of the options -cg87 , -cg89 , or -cg92 , then you must compile all procedures of the program or library with the same option.
  • -dalign 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 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 commands constructed by compiler.
  • -d[y,n] SunOS 5.0 only . Do dynamic or static binding. Default is dynamic . This is a linker option.
  • -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 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 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 -O4 combination. If you combine -fast with other options, the last specification applies. Although the optimization part of -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 .

    For separate compile and link steps: if you compile with -fast , then be sure to link with -fast .

    It is a convenience option, and it chooses the fastest code generation option available on the compile-time hardware ( -cg87 , -cg89 , -cg92 ) an optimization level ( -O3 ), a set of in-line expansion templates, the -fnonstd floating-point option, and the -dalign option. For detail on the constituent options of -fast , see the FORTRAN 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.
  • -fnonstd Do nonstandard initialization of floating-point arithmetic hardware. By default, IEEE 754 floating-point arithmetic is nonstop and underflows are gradual. Specifying -fnonstd during the link step is like having the following at the start of a main program.

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

    The nonstandard_arithmetic() makes underflows always produce zero rather than a possibly subnormal number, as the IEEE standard requires. This may be faster. See ieee_functions (3m).

    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 you use the f77 command, change your search path. For csh , this is usually done in the .cshrc file, with set PATH = at the beginning of a line. The path is different for SunOS 5.0 and SunOS 4.1.x.
    SunOS 5.0 :
  • MANPATH Before you use the man command for f77 man pages, set the man pages path. This is usually done in the .cshrc file, in a line with set MANPATH = at the start. The path is different for SunOS 5.0 and SunOS 4.1.x.
    SunOS 5.0 :
  • LD_LIBRARY_PATH You may have to set the environment variable LD_LIBRARY_PATH . The path is different for SunOS 5.0 and SunOS 4.1.x.
    SunOS 5.0 :

    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 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/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)

    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 Tools

    Profiling Tools

    Programming Libraries

    Linker and Libraries Manual

    The FORTRAN User's Guide has many more examples on such things as the options, making and using libraries, floating point, debuggers, porting, profiling, performance tuning, and the C-FORTRAN interface.

    The FORTRAN Reference Manual has examples for every statement type, and for almost every function and subroutine.

    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 .