Previous | Contents | Index |
The following f90 command compiles the free-format DIGITAL Fortran 90 source files circle-calc.f90 and sub.f90 together using software pipelining optimizations ( -o5 ):
% f90 -O5 -unroll 3 circle-calc.f90 sub.f90 |
The loops within the program are unrolled 3 times (
-unroll 3
). Loop unrolling occurs at optimization level
-o3
or above.
2.1.9 Using Listing Files
If you expect your program to have compilation errors, you should request a separate listing file ( -v option).
For example, the following command compiles DIGITAL Fortran 90 source files with file names that end with .f , and ld creates an executable file named a.out :
% f90 -V *.f |
The listing file assumes the name of the first file. If the first file was named aaa.f , the listing file is named aaa.l .
Using a listing file provides such information as the column pointer (1) that indicates the exact part of the line that caused the error (see Section 2.3.2). Especially for large files, consider obtaining a printed copy of the listing file you can reference while editing the source file.
For More Information:
The
f90
driver program passes options and files not intended for the DIGITAL
Fortran 90 compiler to the
cc
driver program.
2.2.1 f90 Driver Program Interaction with cc and ld
The f90 driver program controls which software components operate on the files and options specified on the f90 command line and their order of use. After preprocessing and compilation by the DIGITAL Fortran 90 compiler, certain files or options are passed to the cc driver program. The cc driver:
Figure 2-1 shows the sequence and use of related software components for an example f90 command.
Figure 2-1 f90 Driver Program and Software Components
The f90 driver does the following:
Upon return to the command line, the f90 driver program returns one of the following status values:
Because the
f90
driver runs other software components, error messages may be returned
by these other components. For instance,
ld
may return a message if it cannot resolve a global reference. Using the
-v
option on the
f90
command line can help clarify which component is generating the error.
2.2.2 make Facility
The make facility is often used to automate building large programs. You can also use the integrated development environment and windowing interface provided by the DEC FUSE optional product, which provides a builder facility that uses make .
For More Information:
Certain options are passed directly from the f90 command driver to the cc compiler driver. These options do not generally apply to compiling DIGITAL Fortran 90 source files, but might be used to:
With the -w c[c...],arg1[,arg2]... option, you can pass ld options not otherwise provided by the f90 command directly to ld .
When compiling a program that contains both DIGITAL Fortran 90 and C language source files, you can usually compile with a single f90 command. Any options that f90 does not recognize are passed to cc , such as the following:
Certain options recognized and used by f90 also apply to cc , such as the -on option. If needed, you can compile the C files using the cc command (instead of the f90 command) with the -c option, and then compile the DIGITAL Fortran 90 files and the (C language) object files using the f90 command.
For more information on the options processed by
cc
, see cc(1) (for most options) or ld(1).
2.3 Compiler Limits, Compiler Messages, and Linker Messages
The following sections discuss the compiler limits and error messages
from the compiler and linker. Other components can report messages, as
described in Section 2.2.1.
2.3.1 Compiler Limits
Table 2-3 lists the limits to the size and complexity of a single DIGITAL Fortran 90 program unit and to individual statements contained within it.
Language Element | Limit |
---|---|
Actual number of arguments per CALL
or function reference |
Limited only by memory constraints. |
Arguments in a function reference
in a specification expression |
255 |
Array dimensions | 7 |
Array elements per dimension | 9,223,372,036,854,775,807 1 |
Constants; character and Hollerith | 2000 characters |
Constants; characters read in list-directed I/O | 2048 characters |
Continuation lines | 511 |
DO and block IF statement nesting (combined) | 128 |
DO loop index variable | 9,223,372,036,854,775,807 1 |
Format group nesting | 8 |
Fortran source line length | 132 characters |
INCLUDE file nesting | 10 levels |
Labels in computed or assigned GOTO list | 500 |
Lexical tokens per statement | 3000 |
Named common blocks | 250 |
Parentheses nesting in expressions | 40 |
Structure nesting | 20 |
Symbolic-name length | 31 characters |
The following are usually limited by the amount of process virtual address space available, as determined by system parameters:
For information on increasing your limits, see Section 1.1.
2.3.2 Compiler Diagnostic Messages and Error Conditions
The DIGITAL Fortran 90 compiler identifies syntax errors and violations of language rules in the source program. If the compiler finds any such errors, it writes messages to the stderr output file and any listing file. If you enter the f90 command interactively, the messages are displayed on your terminal.
Compiler messages have the following format:
f90: severity: filename, line n, message-text [text-in-error] --------^ |
The pointer ( ---^ ) indicates the exact place on the source program line where the error was found. For example, the following error message shows the format and message text in a listing file when an END DO statement was omitted:
f90: Severe: echar.f, line 7: Unclosed DO loop or IF block DO I=1,5 --------^ |
Diagnostic messages usually provide enough information for you to
determine the cause of an error and correct it.
2.3.3 Linker Diagnostic Messages and Error Conditions
If the linker detects any errors while linking object files, it displays messages about their cause and severity. If any errors occur, the linker does not produce an executable program file.
Linker messages are descriptive, and you do not normally need additional information to determine the specific error. The general format for ld messages follows:
ld: message-text |
The message-text may be on multiple lines and is sometimes accompanied by an f90 error.
Some common errors that occur during linking resemble the following:
If an error occurs when you link files, you may be able to correct it by retyping the command string and specifying the correct routines or libraries ( -l string option, -l dir option), or by specifying the object library or object files on the command line.
For More Information:
In addition to option arguments on the f90 command, several statements used in the body of a Fortran program and cpp directives also influence the compilation process.
For More Information:
Within a Fortran 90 program, references to procedures defined outside your program unit need to be declared as external symbols by using the EXTERNAL statement. (In order for BLOCK DATA statement symbols to be resolved by the linker, the BLOCK DATA symbol must be declared EXTERNAL and not have its data type declared in the source program unit.)
During compilation of multiple source files that will be placed into a single object or executable file, the DIGITAL Fortran 90 compiler resolves those symbols referenced in one compilation unit and defined in another before linking occurs.
Upon successful compilation of a DIGITAL Fortran 90 program, the f90 command specifies certain libraries for ld to search for unresolved external symbols in the object file (or files), such as calls to routines in libraries.
You can also specify additional object libraries on the f90 command line by using certain options or by providing the file name of the library. These object libraries are also searched by ld for unresolved external references.
When f90 specifies certain libraries to ld , it provides a standard list of f90 library file names to ld . The ld linker tries to locate each of these library file names in a standard list of library directories; ld attempts to locate each object library file name first in one directory, then in the second, and then in the third directory on its search list of directories.
To display a list of the compilers invoked, files processed, and libraries accessed during linking, specify the -v option on the f90 command line.
In addition to an object file created by the compiler, any linker options and object files specified on the f90 command are also passed to the ld linker. The linker loads object files according to the order in which they are specified on the command line. Because of this, you must specify object libraries after all source and object files on the f90 command line.
For more details on the interaction of the f90 command with other components, see Section 2.2.1.
To help you identify undefined references to routines or other symbols in an object file, consider using the nm command. For instance, the following nm command filtered by the grep command lists all undefined (U) symbols:
% nm -o ex.o | grep U |
If the symbol is undefined, a "U" appears in the column before the symbol name. Any symbols with a U in their names are also displayed by this use of grep .
Previous | Next | Contents | Index |