Posted Feb 10, 2012 22:22 UTC (Fri) by dfsmith (guest, #20302)
Parent article: Betrayed by a bitfield
To quote from Harbison & Steele 3rd ed. (1991)* section 4.4.5
"... any object ... of a volatile-qualified type should not participate in optimizations that would ... modif[y] the object."
To my mind that prohibition includes non-volatile object optimizations that would clobber volatile objects.
The book then slightly contradicts itself two paragraphs later by saying that "optimizations between sequence points are permitted" before clarifying with a hardware example.
* A standard ANSI C reference manual for programmers and compiler implementers at the time.