Previous | Contents | Index |
Specifying the -cpp option runs the C preprocessor cpp on all Fortran source files before compiling. The default is -nocpp . This option and the C preprocessor give the same results on Tru64 UNIX and Linux systems.
The following cpp macros are defined by the f90 command when any .f90 , .F90 , .f , .F , .for , or .FOR file is being compiled:
LANGUAGE_FORTRAN_90 (TU*X ONLY)
__LANGUAGE_FORTRAN_90__ (TU*X ONLY)
LANGUAGE_FORTRAN (TU*X ONLY)
__LANGUAGE_FORTRAN__ (TU*X ONLY)
linux (L*X ONLY)
__linux__ (L*X ONLY)
__alpha
__osf__ (TU*X ONLY)
unix (TU*X ONLY)
__unix__ (TU*X ONLY)
__OPENMP if -omp is specified (TU*X ONLY)
If you omit -cpp and -P , the cpp preprocessor is not run unless the file name suffix is .F (for fixed-form source files) or .F90 (for free-form source files).
If you specify
-cpp
or
-P
, you can also specify the related options described in Section 3.26.1
to Section 3.26.7.
3.26.1 -Dname and -Dname=def --- Define cpp Names
Specifying -Dname or -Dname=def defines name to the cpp preprocessor, as if the name were specified using the #define cpp directive. If no definition is given after -D , the name is defined as "1".
This option is also used by the compiler for conditional compilation
with Fortran directives (see Section 3.27).
3.26.2 -I --- Remove Directory from cpp Include Search Path
Specifying
-I
prevents
cpp
from searching for
#include
files in the standard directory
/usr/include
(see Section 3.26.2).
3.26.3 -Idir --- Add Directory to cpp Include Search Path
Specifying -Idir directs cpp to search for #include files whose names do not contain an absolute pathname, in the following order:
This option also specifies additional directories in which to search
for Fortran module and include files (see Section 3.45).
3.26.4 -K --- Keep Temporary Files
Specifying
-K
requests that temporary files created by
cpp
or the Compaq Fortran compiler not be automatically deleted. See
Section 3.49 for more information.
3.26.5 -M --- Request cpp Dependency Lists for make
Specifying
-M
requests that
cpp
generate dependency lists suitable for
make
, instead of the normal output.
3.26.6 -P --- Retain cpp Intermediate Files
Specifying
-P
runs only the
cpp
preprocessor and puts the result for each source file, by suffix
convention (for example,
.f
and
.s
), in a corresponding
.i
file, after being processed by appropriate preprocessors. The
.i
file does not have line numbers (#) in
it. This sets the
-cpp
option.
3.26.7 -Uname --- Undefine cpp Name
Specifying
-Uname
removes the definition of name, such as a predefined symbol.
This option is also used by the compiler to remove symbol names from
conditional compilation using Fortran directives (see Section 3.82).
3.26.8 -Wp,-xxx --- Pass Specified Option to cpp
The -Wp,-xxx option allows you to pass an option directly to the cpp preprocessor, where -xxx is the option to be passed to cpp .
Specifying -Dname or -Dname=def or -Dname="string" defines name for use by either the cpp preprocessor or by Fortran conditional compilation. When name=def is used for Fortran conditional compilation, def can be an integer or a character string delimited by double quotation marks as in -Dvehicle_type="red convertible" . When name=def is used for the cpp preprocessor, the definition is interpreted as if by #define . Regardless of the usage, if no definition is given, then name is defined as the single character "1".
An example command is next.
% f90 -Dnum=4 -Dber -Dclock="the time" foo.f90 |
In this example num is the integer 4, ber is the single character "1", and clock is the string "the time".
Preprocessor symbols can be used for conditional compilation by using the cDEC$ IF directive construct (see the Compaq Fortran Language Reference Manual) or by using cpp . Predefined preprocessor symbols are defined in Section 3.26.
Specifying -noD prevents the compiler from receiving any -Dxxx or -Uxxx options. The default is to allow the compiler to receive these options. However, the cpp preprocessor always receives these options.
On the C preprocessor, see cpp(1).
3.28 -d_lines --- Debugging Statement Indicator, Column 1
Use the -d_lines option to request that lines in fixed-format source files that have a D or a d character in column 1 be compiled instead of treated as comment lines. Such lines might print the values of variables or otherwise provide useful debugging information.
The default ( -nod_lines ) treats all lines with a D or a d in column 1 as comment lines. The -d_lines option does not apply to free-format files.
Use
-d_lines
to control whether lines with a D or d character in column 1 are
treated as comments or not.
3.29 -double_size 128, -double_size 64 --- Double Precision Data Size
Use the -double_size 128 option to specify the size of DOUBLE PRECISION and DOUBLE PRECISION COMPLEX declarations, constants, functions, and intrinsics as REAL (KIND=16) and COMPLEX (KIND=16) native (IEEE style) X_float format.
If you omit
-double_size 128
,
-double_size 64
is used where DOUBLE PRECISION and DOUBLE PRECISION COMPLEX
declarations are treated the same as REAL (KIND=8) and COMPLEX (KIND=8)
declarations.
3.30 -error_limit num, -noerror_limit --- Limit Error Messages
Use the -error_limit num and -noerror_limit options to specify the maximum number of error-level or fatal-level compiler errors allowed for a given file specified on the f90 command line.
If you specify -noerror_limit , there is no limit on the number of errors that are allowed.
The default is
-error_limit 30
or a maximum of 30 error-level and fatal-level messages. If the maximum
number of errors is reached, a warning message is issued and the next
file (if any) on the command line is compiled.
3.31 -extend_source --- Line Length for Fixed-Format Source
Specifying the -extend_source option treats the statement field of each source line in a fixed-format file as ending in column 132 instead of column 72. The default ( -noextend_source or -col72 ) allows 72-column lines; all apply only to fixed-format source files. Specifying -extend_source sets the -fixed option. Using -extend_source or -col132 sets the source to fixed format even if implicit naming rules set it to free format.
Specifying -f66 , -66 , or -nof77 (all are equivalent) allows extensions that enhance FORTRAN 66 (FORTRAN IV) compatibility. The default is -nof66 , which specifies that FORTRAN-77 interpretation rules are used for those statements that have a meaning incompatible with FORTRAN 66. If you specify -f66 , the compiler selects FORTRAN 66 interpretations in cases of incompatibility.
One of the differences is that in FORTRAN 66, DO loops are executed at least once. You can specify -onetrip or -1 to request that DO loops be executed at least once. Specifying -f66 (or -66 ) sets -onetrip .
If you omit
-onetrip
,
-1
,
-nof77
, or
-f66
, DO loops whose lower range exceeds the upper range will not be
executed.
3.32.1 -f77rtl --- Use Fortran 77 Run-time Behavior
Specifying
-f77rtl
tells the compiler to create an executable file whose runtime behavior
is that of Compaq Fortran 77 instead of Compaq Fortran. This behavior
affects, for example, the acceptable input forms for the NAMELIST
statement. The default value is
-nof77rtl
.
3.33 -fast --- Set Options to Improve Run-Time Performance
Specifying -fast sets the following options:
Avoid using the -fast option unless you understand the options that -fast sets. For example, the -fast option sets the -fp_reorder and -math_library fast options, which can change the calculated results of a program. Also, before you use -fast with the -wsf option, first make sure your program does not use any zero-sized arrays or array sections (see Section 3.92). And, while the setting of -arch host and -tune host generates optimal code for the computer architecture on which the compiler is running, this code may run slowly on another version of the computer architecture.
The default is
-nofast
.
3.34 -feedback file, -gen_feedback, -cord --- Create and Use Feedback Files
These options apply only to TU*X systems.
Allows the creation and use of a feedback file, which can improve run-time performance. You can optionally use cord to rearrange procedures.
You create a feedback file by using a series of commands, including f90 with the -gen_feedback option, pixie (TU*X ONLY), and prof (see the Section 5.2.3).
-cord
Specifying -cord runs the procedure-rearranger cord after the linker creates the executable program. This rearrangement reduces the cache conflicts of the program's text. The output of cord is left in the file specified by the -o output option or a.out by default. At least one -feedback file must be specified.-feedback file
Specifying -feedback file indicates that file is a feedback file. You can use this option with the -cord option.This file is produced by the prof command with its -feedback option from an execution of the program produced by the pixie command (TU*X ONLY).
-gen_feedback
Used with the f90 command to request that the compiler generate code that allows accurate feedback information for subsequent use of the -feedback file option.Using -gen_feedback changes the default optimization level from -O4 to -O0 . Avoid using -gen_feedback with optimizations higher than -O3 .
Use the -fixed and -free options to specify the source form:
-fixed
Specifying -fixed indicates that the source form is fixed format, regardless of the file name suffix. Source files with a suffix of .f , .for , and .FOR are assumed to contain fixed source form.-free
Specifying -free indicates that the source form is free format, regardless of the file name suffix. Source files with a suffix of .f90 or .F90 are assumed to contain free source form.
You cannot specify both -free and -fixed on the same f90 command line.
Table 3-2 summarizes how the -free and -fixed options interact with the file suffix of a source file.
Suffix | -free Option | -fixed Option | Expected Source Form |
---|---|---|---|
.f90, .F90 | Not specified | Not specified | Free form |
.f90, .F90 | Specified | Not specified | Free form |
.f90, .F90 | Not specified | Specified | Fixed form |
.f, .F, .for, .FOR | Not specified | Not specified | Fixed form |
.f, .F, .for, .FOR | Specified | Not specified | Free form |
.f, .F, .for, .FOR | Not specified | Specified | Fixed form |
Specifying -fpconstant requests that a single-precision constant assigned to a double-precision variable be evaluated in double precision.
If you omit -fpconstant , a single-precision constant assigned to a double-precision variable is evaluated in single precision. The Fortran standard requires that the constant be evaluated in single precision.
Certain programs created for FORTRAN-77 compilers (including Compaq Fortran 77) may show different results, because they rely on single-precision constants assigned to a double-precision variable to be evaluated in double precision.
In the following example, if you specify -fpconstant , identical values are assigned to D1 and D2. If you omit the -fpconstant option, Compaq Fortran will obey the standard and assign a less precise value to D1.
REAL (KIND=8) D1, D2 DATA D1 /2.71828182846182/ ! REAL (KIND=4) value expanded to double DATA D2 /2.71828182846182D0/ ! Double value assigned to double |
Use the -fpe0 , -fpe1 (TU*X ONLY), -fpe2 (TU*X ONLY), -fpe3 , or -fpe4 (TU*X ONLY) options to control floating-point exception handling at run time for the main program. This includes whether exceptional floating-point values are allowed and how precisely run-time exceptions are reported. Use the -fpen options to specify the following:
To obtain the fastest run-time performance, use -fpe0 . For performance reasons, the default is -fpe0 (many programs do not need to handle denormalized numbers or other exceptional values). Using other -fpen values will slow run-time performance.
To associate an exception with the instruction that causes the exception, specify any value other than -fpe0 (or specify -synchronous_exceptions ). Specifying -fpe2 or -fpe4 displays error messages indicating the cause of the exceptions.
Using -fpe0 (default) can create a core file. Examining the core file shows the exception one or more instructions after the instruction that caused the exception (unless you also specified -synchronous_exceptions ).
To allow source line correlation when using a debugger to locate the exception, specify the -g option when compiling the program (see Chapter 4).
Table 3-3 summarizes the floating-point exception handling options.
Option | Handling of Underflow | Handling of Divide by Zero, Overflow, and Invalid Data |
---|---|---|
-fpe0 , -fpe | Sets any calculated denormalized value (result) to zero and lets the program continue. A message is displayed only if -check underflow is also specified. Any use of a denormalized number in an arithmetic expression uses a value of 0.0 and execution continues. | Exceptional values are not allowed. The program terminates after displaying a message and creating a core dump file. The exception location is one or more instructions after the instruction that caused the exception, unless -synchronous_exceptions was specified. |
-fpe1 | (TU*X ONLY) Sets any calculated denormalized value to zero and lets the program continue. A message is displayed only if -check underflow is also specified. Use of a denormalized number in an arithmetic expression uses a value of 0.0 and execution continues. | The program continues (no core dump). No message is displayed. A NaN or Infinity (+ or --) exceptional value is generated. |
-fpe2 | (TU*X ONLY) Sets any calculated denormalized value to zero and lets the program continue. A message is displayed ( -check underflow is not needed). Use of a denormalized (or exceptional) number in an arithmetic expression results in program continuation, but with slower performance. | The program continues (no core dump). A message is displayed a maximum of twice for each type of exception. A NaN or Infinity (+ or --) is generated. |
-fpe3 | Leaves any calculated denormalized value as is. The program continues, allowing gradual underflow. Use of a denormalized (or exceptional) number in an arithmetic expression results in program continuation, but with slower performance. A message is displayed only if -check underflow is also specified. | The program continues (no core dump). No message is displayed. A NaN or Infinity (+ or --) is generated. |
-fpe4 | (TU*X ONLY) Leaves any calculated denormalized value as is. The program continues, allowing gradual underflow. Use of a denormalized (or exceptional) number in an arithmetic expression results in program continuation, but with slower performance. A message is displayed ( -check underflow is not needed). | The program continues (no core dump). A message is displayed a maximum of twice for each type of exception. A NaN or Infinity (+ or --) is generated. |
With -fpe2 (TU*X ONLY) and -fpe4 (TU*X ONLY), a count of how many occurrences of each type of exception is displayed upon program completion.
The exception message reporting specified by the -fpen options applies only to the main program and cannot be changed during program execution.
To help you debug a routine, you can associate an exception with the instruction that causes it by specifying any value other than -fpe0 (such as -fpe3 ) or specify -synchronous_exceptions .
When compiling different routines in a program separately, you should use the same -fpen value. For example, assume:
If routine A passes an exceptional value to routine B and routine B uses that exceptional value in an arithmetic expression, program execution stops and a core file is created.
You can call the for_set_fpe routine to set the floating-point exception handling for subprograms (including C functions) or perhaps to change the setting for the main program.
To use for_set_fpe in most cases, you should recompile the program with -fpe1 or higher. You should not change the exception settings to request program continuation with for_set_fpe if you compiled the program using -fpe0 .
Both the for_set_fpe and for_get_fpe routines can be used by Fortran programs using the INTEGER parameter values located in /usr/include/for_fpe_flags.f . Programs written in C can call the for_rtl_init_ routine prior to calling the for_get_fpe or for_get_fpe routines, and must include an equivalent header file, /usr/include/for_fpe_flags.h .
For programs that use a number of denormalized values (such as those that allow gradual underflow with -fpe3 or -fpe4 ), the impact on run-time performance can be significant.
If you use the -math_library fast (or -fast ) option along with an -fpen option, the -fpen option is ignored when arithmetic values are evaluated by math library routines.
If you specify the -speculate all or -speculate by_routine options along with one of the -fpen options that request exception reporting, exceptions are not reported as expected (see Section 3.74).
Previous | Next | Contents | Index |