The VOLATILE statement specifies that a value is entirely unpredictable, based on information local to the current program unit. It prevents specified variables, arrays, and common blocks from being optimized during compilation.
The VOLATILE statement takes the following form:
VOLATILE nlist
If array names or common block names are used, the entire array or common block becomes volatile, as the following example shows.
In the following statements, the named common block, BLK1, and the variables D and E are volatile. Variables P1 and P4 become volatile because of the direct equivalence of P1 and the indirect equivalence of P4.
PROGRAM TEST LOGICAL*1 IPI(4) INTEGER*4 A,B,C,D,E,ILOOK INTEGER*4 P1,P2,P3,P4 COMMON /BLK1/A,B,C VOLATILE /BLK1/,D,E EQUIVALENCE(ILOOK,IPI) EQUIVALENCE (A,P1) EQUIVALENCE (P1,P4)
For details about the optimizations performed by the compiler and the circumstances under which you should use the VOLATILE declaration, see your user manual.