compatible with implementations that allocate static storage, compile with the +saveoption. This option causes the compiler to act as though all local variables had the SAVEattribute.

As mentioned in “Automatic and static variables” (page 67), saving all variables in static storage can degrade performance. If performance is an issue, consider using the +Oinitcheck option. Unlike the +save option, +Oinitcheckdoes not “save” variables—it does not move variables into static storage.Instead, it causes the compiler to search for all local, nonarray, nonstatic variables that have not been defined before being used. Any that it finds are initialized to 0 on the stack each time the procedure in which they are declared is invoked.

For detailed information about the +save and +Oinitcheck options, see HP Fortran Programmer’s Reference.

Large word size

The word size of default integers, reals, and logicals in HP Fortran is 4 bytes. However, some implementations of Fortran 90—notably, Cray—use an 8-byte word size. Programs written for these implementations may rely on the increased precision and range in their computations.

You can double the sizes of default integer, real, and logicals by compiling with the +autodbl option, making them compatible with implementations that use the larger word size. This option also doubles the sizes of items declared with the COMPLEXand DOUBLE PRECISIONstatements, but not the BYTEand DOUBLE COMPLEXstatements.

Increasing the size of double-precision items can degrade the performance of your program. If you do not need the extra precision for items declared with the DOUBLE PRECISIONstatement, use the +autodbl4 option, which increases single-precision items only. Compiling with this option results in items declared as default real and double precision real having the same precision—a violation of the Standard.

For usage information about the +autodbland +autodbl4options, see “Increasing default data sizes” (page 70). For detailed descriptions of these options, see the HP Fortran Programmer’s Reference.

One-trip DO loops

If a loop is coded so that its initial loop count is greater than its final loop count, standard Fortran 90 requires that the loop never execute. However, under some implementations of FORTRAN 66, if a DO loop is reached, it executes for at least one iteration, even if the DO variable is initialized to a value greater than the final value. This is called a one-trip DO loop.

To duplicate the behavior of a one-trip DOloop in an HP Fortran program, compile with the +onetripoption. To see the effects of this option, consider the following program:

PROGRAM main DO 10 i = 2, 1

PRINT *, 'Should never happen in standard Fortran 90.' 10 CONTINUE

END PROGRAM main

When compiled with the command line:

$ f90 test_loop.f90

the PRINTstatement will never execute because the initial loop count is higher than the final loop count. To force the loop to execute at least once, compile it with the command line:

$ f90 +onetrip test_loop.f90

When you run the program now, it produces the output:

$ a.out

Should never happen in standard Fortran 90.

Using porting options 145