Compiler Optimizations

Many Fortran compilers perform code-generation optimizations to increase the speed of execution or to decrease the required amount of memory for the generated code. Although the behaviors of both the optimized and nonoptimized programs fall within the language standard specification, different behaviors can occur in areas not covered by the language standard. Compiler optimization especially can influence floating-point numeric results.

The Visual Fortran compiler can perform optimizations to increase execution speed and to improve floating-point numerical consistency. For a summary of optimization levels, see Optimization Levels and Other Options Related to Optimization.

Floating-point consistency refers to obtaining results consistent with the IEEE binary floating-point standards (see the /fltconsistency option).

Unless you properly design your code, you might encounter numerical difficulties when you optimize for fastest execution. The /nofltconsistency option uses the floating-point registers, which have a higher precision than stored variables, whenever possible. This tends to produce results that are inconsistent with the precision of stored variables. The /fltconsistency option (also set by /Oxp) can improve the consistency of generated code by rounding results of statement evaluations to the precision of the standard data types, but it does produce slower execution times.