title: Is a C compiler allowed to coalesce sequential assignments to volatile variables?
body: <p>I'm having a theoretical (non-deterministic, hard to test, never happened in practice) hardware issue reported by hardware vendor where double-word write to certain memory ranges may corrupt any future bus transfers.</p>
  <p>While I don't have any double-word writes explicitly in C code, I'm worried the compiler is allowed (in current or future implementations) to coalesce multiple adjacent word assignments into a single double-word assignment.</p>
  <p>The compiler is not allowed to reorder assignments of volatiles, but it is unclear (to me) whether coalescing counts as reordering. My gut says it is, but I've been corrected by language lawyers before!</p>
  <p>Example:</p>
  <pre><code>typedef struct
  {
     volatile unsigned reg0;
     volatile unsigned reg1;
  } Module;
  
  volatile Module* module = (volatile Module*)0xFF000000u;
  
  // two word stores, or one double-word store?
  module-&gt;reg0 = 1;
  module-&gt;reg1 = 2;
  </code></pre>
  <p>(I'll ask my compiler vendor about this separately, but I'm curious what the canonical/community interpretation of the standard is.)</p>