3 ms·
This paper misstates the proper behavior of volatile to start In particular, it says "For every read from or write to a volatile variable that would be perform
by DannyBee 13y ago
This paper misstates the proper behavior of volatile to start
In particular, it says "For every read from or write to a volatile variable that would be performed by a straightforward interpreter for C, exactly one load from or store to the memory location(s) allocated to the variable must be performed."
This is wrong. It later kind of gets it right for C, explaining about sequence points, but it entirely misses that implementations are free to combine and eliminate multiple volatile accesses within the same sequence point.
Now certainly, most of what was reported were genuine bugs (and John reports a lot of correctness issues).
But it does/did nobody favors to start with an incorrect definition.
- cnvogel 13y agoI think if you replace "straightforward interpreter for C" with the "abstract state machine" in the standard (I'm looking at ISO/IEC 9899:1999 right now), at least the first half of the sentence you qoute it's pretty much what the standard says: ❝An object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. Therefore any expression referring to such an object shall be evaluated strictly according to the rules of the abstract machine...❞ (§6.7.3) For combining multiple volatile accesses within the same statement, I think I cannot find an answer in the standard.