Prevents specified variables, arrays, and common blocks from being
optimized during compilation.
The VOLATILE attribute can be specified in a type declaration
statement or VOLATILE statement, and takes one of the following
forms:
Type Declaration Statement:
type, [att-ls,] VOLATILE [,attr-ls] :: obj [,obj]...
Statement:
VOLATILE obj [,obj]...
type Is a data type specifier.
attr-ls Is an optional list of attribute specifiers.
obj Is the name of an object or a common block
enclosed in slashes.
A variable or COMMON block must be declared VOLATILE if it can be
read or written in a way that is not visible to the compiler. For
example:
o If an operating system feature is used to place a variable in
shared memory (so that it can be accessed by other programs),
the variable must be declared VOLATILE.
o If a variable is modified by a routine called by the operating
system when an asynchronous event occurs, the variable must be
declared VOLATILE.
If an array is declared VOLATILE, each element in the array becomes
volatile. If a common block is declared VOLATILE, each variable in
the common block becomes volatile.
If an object of derived type is declared VOLATILE, its components
become volatile.
If a pointer is declared VOLATILE, the pointer itself becomes
volatile.
A VOLATILE statement cannot specify the following:
o A procedure
o A function result
o A namelist group
The VOLATILE attribute is compatible with the ALLOCATABLE,
AUTOMATIC, DIMENSION, INTENT, OPTIONAL, POINTER, PRIVATE, PUBLIC,
SAVE, STATIC, and TARGET attributes.