Volatile Memory Locations

Typically memory mapped devices use a volatile declaration modifier to prevent the compiler from optimizing out loads and stores. The current implementation of the optimizer uses read-modify-write instructions where possible instead of a load, operation, store instruction sequence. If this presents a problem for a particular device, you need to turn off the peephole optimizer for routines accessing it, as shown below:

  #pragma peephole off  
  void foo (void)  
  {...}  
  #pragma peephole reset