ISO/IEC JTC1 SC22 WG21 P0612R0
The least requirements on a conforming implementation are:Change in 1.9 [intro.execution] paragraph 12:
Access to volatile objectsare evaluated strictly according to the rules of the abstract machine.
Reading an object designated by a volatile glvalue (3.10), modifying an object, calling a library I/O function, or calling a function that does any of those operations are all side effects, which are changes in the state of the execution environment. Evaluation of an expression (or a sub-expression) in general includes both value computations (including determining the identity of an object for glvalue evaluation and fetching a value previously assigned to an object for prvalue evaluation) and initiation of side effects. When a call to a library I/O function returns or an accessChange in 1.10.2 [intro.progress] paragraph 1:
to a volatile objectis evaluated the side effect is considered complete, even though some external actions implied by the call (such as the I/O itself) or by the volatile access may not have completed yet.
The implementation may assume that any thread will eventually do one of the following:Change in 1.10.2 [intro.progress] paragraph 3:
[ Note: ... ]
- make a call to a library I/O function,
read or modify a volatile object, or
- perform a synchronization operation or an atomic operation.
Change in 18.104.22.168 [dcl.type.cv] paragraph 6:
During the execution of a thread of execution, each of the following is termed an execution step:
- termination of the thread of execution,
access to a volatile object,or
- completion of a call to a library I/O function, a synchronization operation, or an atomic operation.
Drafting note: A volatile member in a class does not prevent the class from having a trivial copy constructor. That means, in particular, that values of such types can be passed in registers. I personally consider this incorrect, but the ABI breakage inherent in changing the direction was considered too severe. See core issues 496 and 2094.
What constitutes an access to an object that has volatile-qualified type isimplementation-defined. If an attempt is made to refer toan object defined with a volatile-qualified type through the use of a glvalue with a non-volatile-qualified type, the behavior is undefined.