If the compiler really uses the variable as a scratch storage, it will be aThese markings already exist, namely, the "volatile" keyword, READ_ONCE(),
problem if the variable can be accessed concurrently from multiple CPUs. It
is a new compiler optimization strategy that I am aware before. In that
case, we may really need a way to mark these variables as not suitable for
such advanced optimization.
WRITE_ONCE(), and hopefully soon INC_ONCE(). These last three use
volatile accesses internally.
The scratch-storage possibility exists only just before a normal
C-language store, not before volatile accesses. So a compiler is
forbidden from doing that scratch-value-store trick before a volatile
store.