On Fri, 12 Jun 2015 09:36:54 +0100 Andrew Haley <aph@xxxxxxxxxx> wrote: > Eh? The vriable access is a memory operation in [2]. It is > surrounded by the cli/sei, as required. We cannot guarantee that > non-memory operations will not be reordered with memory barriers, > though. You mean the assignment to "ivar" (only that is "surrounded")? Sorry that I wasn't clear about that. I meant the assignment to the local variable "val". It's moved across the barrier. That's the whole point about the example. > > Still the open question: Is access to array elements (or > > dereferencing a pointer) always considered a "memory operation", > > Yes. So what's the difference between that variable "val" and my array elements, if I remove the "volatile"? - Is it that I have array elements / pointer dereferencings? (I think so) - Or that it's a global variable? (Probably not - shouldn't make a difference, at least when global but static) - Or is it because I'm not concerned about timing, just about correctness? (Probably not) Sebastian