DIGITAL Fortran 90
User Manual for
DIGITAL UNIX Systems


Previous Contents Index

3.34 -fpconstant --- Handling of Floating-Point Constants

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 90 standard requires that the constant be evaluated in single precision.

Certain programs created for FORTRAN-77 compilers (including DIGITAL 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, DIGITAL Fortran 90 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 

3.35 -fpen --- Control Arithmetic Exception Handling and Reporting

Use the -fpe0 , -fpe1 , -fpe2 , -fpe3 , or -fpe4 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.

Table 3-3 Summary of Floating-Point Exception Command 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 (invalid data) in an arithmetic expression results in an invalid operand error. The program stops, creating a core dump file. 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 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 (or exceptional) number in an arithmetic expression results in program continuation, but with slower performance. The program continues (no core dump). No message is displayed. A NaN or Infinity (+ or --) exceptional value is generated.
-fpe2 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 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 and -fpe4 , 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.70).

For More Information:

3.36 -fprm keyword --- Control Floating-Point Rounding Mode

The -fprm nearest , -fprm dynamic , -fprm chopped , or -fprm minus_infinity options allow you to control how rounding occurs during calculations.

-fprm nearest

This is the normal rounding mode, where results are rounded to the nearest representable value. If you omit other -fprm options, -fprm nearest is used.

-fprm chopped

Results are rounded toward zero (representative value).

-fprm minus_infinity

Results are rounded toward the next smallest representative value.

-fprm dynamic

Lets you set the rounding mode at run-time. You can modify your program to:

When you call write_rnd , you can set the rounding mode to one of the following settings (see write_rnd(3)):

If you compile with -fprm dynamic and do not call write_rnd , the initial rounding mode is round toward nearest ( -fprm nearest ).

For the fastest run-time performance, avoid using -fprm dynamic .

The rounding mode applies to each program unit being compiled.

For More Information:

3.37 -fuse_xref --- Cross-Reference Information for DEC FUSE

Use the -fuse_xref option to request that DIGITAL Fortran 90 generate a data file that the DEC FUSE Database Manager uses to create a cross-reference database file. This improves the performance of the DEC FUSE Call Graph Browser and Cross-Referencer that use the database file for their operations.

For More Information:

On DEC FUSE components, see the DEC Fuse Handbook.

3.38 -g0, -g1, -g2 or -g, -g3, -ladebug --- Symbol Table Information

Use the -g0 , -g1 , -g2 , or -g , -g3 , and -ladebug options to control the amount of symbol table information in the object file (the default is -g1 ).

If you intend to use the DIGITAL Ladebug Debugger, specify the -ladebug option and one of the following: -g , -g2 , or -g3 .

The following options apply (the default is -g1 ):

-g0

Specifying -g0 provides no traceback or symbol table information needed for debugging or profiling. Only symbol information needed for linking (global symbols) is produced. The size of the resulting object file is the minimum size.

-g1

Specifying -g1 (the default) produces traceback information, which allows program counter to source file line correlation, but not symbol table information needed for debugging. Specifying -g1 produces the global symbol information needed for linking or profiling.

The object file size is somewhat larger than if -g0 was specified, but is smaller than if either -g2 or -g3 was specified.

-g2 or -g

Specifying -g2 or -g produces the following:

If you use this option and do not specify an -on option, the default optimization level changes to -o0 , which disables nearly all optimizations to make debugging more accurate (the default optimization level is usually -o4 ). If you use this option and specify an -on option other than -o0 , a warning message is displayed.

-g3

Specifying -g3 produces traceback information, symbol table information needed for symbolic debugging of optimized code, and global symbol information needed for linking or profiling. This option can provide additional debugging information to describe the effects of optimization, but debugging inaccuracies may occur as a result of optimizations.

-ladebug

When you specify -g , -g2 , or -g3 , specifying -ladebug produces additional symbolic debugger information for the DIGITAL Ladebug Debugger. This allows use of standard Fortran 90 syntax when printing dynamic arrays using DIGITAL Ladebug, including array sections.

If you specify -g0 or -g1 (default) with -ladebug , the -ladebug option is ignored.

For More Information:

3.39 -granularity keyword --- Control Shared Memory Access to Data

The -granularity keyword options allow you to control the size of shared data in memory that can be safely accessed from different threads. You do not need to specify this option for local data access by a single process, unless asynchronous write access from outside the user process might occur. The default is -granularity quadword .

To be written from multiple threads, data must be declared as VOLATILE (so it is not held in registers) and naturally aligned. To ensure alignment in common blocks, derived-type structures, and record structures, use the -align keyword option.

-granularity byte

Requests that all data 1 byte or greater can be accessed from different threads sharing data in memory. This option will slow run-time performance.

-granularity longword

Ensures that naturally aligned data of 4 bytes or greater can be accessed safely from different threads sharing access to that data in memory. Accessing data items of three bytes or less and unaligned data may result in data items written from multiple threads being inconsistently updated.

-granularity quadword

Ensures that naturally aligned data of 8 bytes can be accessed safely from different threads sharing data in memory. Accessing data items of 8 bytes or less and unaligned data may result in data items written from multiple threads being inconsistently updated. This is the default.

For More Information:

3.40 -hpf_matmul --- Use Prior Version of MATMUL Intrinsic

Use the -hpf_matmul option to use matrix multiplication from an HPF library routine rather than the regular DIGITAL Fortran 90 intrinsic code. The HPF library matrix multiplication routine is used only for nonparallel compilations.

3.41 -I --- Remove Directory from Include Search Path

Specifying -i prevents compiler from searching for #include files in the standard directory /usr/include . This option has no effect on the Fortran 90 USE statement but does affect the INCLUDE statement.

3.42 -Idir --- Add Directory for Module and Include File Search

Use the -idir option to specify an additional directory in which to search for module files (USE statement) and include (INCLUDE statement) files.

You can repeat the -idir option as many times as needed to specify multiple additional search directories.

To prevent the DIGITAL Fortran 90 compiler from searching for include files in the /usr/include directory, use the -noinclude option.

This option also specifies additional directories for the cpp preprocessor to search for #include files.

For More Information:


Previous Next Contents Index