HP 3000 Manuals

VOLATILE Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

VOLATILE Statement (Nonexecutable) 

The VOLATILE statement specifies variables, arrays, and common blocks
that will not be selected for global analysis and optimization by the
compiler.

[]
---------------------------------------------------------------------------------------------- | | | | | Item | Description/Default | Restrictions | | | | | ---------------------------------------------------------------------------------------------- | | | | | variable_name | Variable, array, record, or common | None. | | array_name | block that is not being optimized. | | | record_name | | | | common_block_name | | | | | | | ---------------------------------------------------------------------------------------------- Semantics The VOLATILE statement is an extension to the ANSI 77 standard. If an array variable name is specified, all of the elements in that array become volatile. Likewise, if a common block variable is specified, the entire common block becomes volatile. A variable that is overlapping (through EQUIVALENCE) on a volatile variable also becomes volatile. Even though variables, arrays, records, and common block names listed in a VOLATILE statement are allocated storage, the VOLATILE statement cannot be used for declaring the size of an array or common block. When referenced, volatile variables are loaded from memory. When a volatile variable is changed, the variable is stored into memory (that is, the variable is not held in the registers). Variables can be placed in shared memory with the SHARED_COMMON compiler directive so that they can be accessed by more than one program. Any variable placed in shared common is considered volatile. If you declare a common block as shared common, the compiler implicitly attributes volatile to that block. That is, you do not have to separately declare a common block as volatile and then compile and install that common block as shared. The VOLATILE statement can also be used when variables, arrays, or common blocks are shared between the program and the exception handler. If you do not use the VOLATILE statement, the exception handler might use the incorrect value for a shared quantity because the value was kept in the registers and not updated in memory. Example Notes --------------------------------------------------------------------------------------- INTEGER a, b, c, d The common block block1 and variables q and INTEGER p, q, r r are volatile and will not be selected for COMMON /block1/ a, b, c global analysis or optimization. An VOLATILE /block1/, q, r equivalent VOLATILE statement is VOLATILE q, r, /block1/ INTEGER a, b The variable b also becomes volatile. EQUIVALENCE (a,b) VOLATILE a


MPE/iX 5.0 Documentation