I use compiler barriers to guarantee code correctness for the levels at which I work.
But in this case, I wonder if the pointer "a" is simply not being declared the way you want it to work? There's a difference between "the pointer is volatile" and the "data the pointer points at is volatile."
In this case, the generated compiler code appears to be assuming you care only about the "data the pointer points at" being volatile, not the pointer itself.
[EDIT}: try this instead?
int *volatile a;Or both parts volatile:
int volatile * volatile a;[EDIT2]: Reference link:
http://www.embedded.com/electronics-blog...olatile-Keyword