J3/03-129 To: J3 From: UK Fortran panel Subject: Edits for UK comment MTC2 (Remove ambiguities re VOLATILE) Date: 10 March 2003 MTC2 The UK comment was: Remove ambiguities re VOLATILE The text needs to be clarified to avoid the problem of a variable being referenced while it is in the process of being changed. The description of VOLATILE does not specify whether truly asynchronous updates are possible, where some bytes (or larger units) of a variable are updated by one mechanism at the same time as others are retrieved by another mechanism. Given this true asynchronicity, the value retrieved by a VOLATILE variable access could have some bytes from the old (pre-the-update) value and some from the new (post-the-update) value. This combination of partial values could cause trouble with floating-point numbers (e.g. spuriously providing a signalling NaN), and is particularly likely to cause trouble with values containing pointers - using a partially updated pointer could well lead to immediate uncontrollable program termination (seg fault/bus error). Possible edits are the following: Page 83: 8+ Add: If the value or properties of an object with the VOLATILE attribute are changed by means not specified in this standard, any change shall appear to the Fortran program as if it had taken place immediately before or immediately after the execution of an executable Fortran statement. Furthermore, when executing the statement immediately following such a change, the object shall be in a consistent state as if it had been changed by operations defined by this standard. and replace Note 5.23 by: The Fortran processor should use the most recent definition of a volatile object when a value is required, should make the most recent Fortran definition available, and should ensure that the above consistency rule holds. It is the programmer's responsibility to manage the interactions with the non-Fortran processes and to obey any constraints documented by the Fortran processor. No other edits are suggested.