title: Prevent optimizations for one operation in c
body: <p>I'm implementing an algorithm using compensated summation to reduce the amount of roundoff errors adding up. I'm wondering if I can tell the compiler somehow not to optimize the floating point operations in one specific part of the code. More precisely, I'd like to keep the order of operations preserved. Here is an example code snippet (all variables are <code>double</code>):</p>
  
  <pre><code>while(1){
      a = y;
      e = e + d;
      y = a + e;
      e = e + (a - y);
  }
  </code></pre>
  
  <p>I'm worried that the last line could be <em>optimized</em> to read <code>e=e-e</code> or <code>e = (e+a)-y</code>. In which circumstances could this happen and how can I prevent it?</p>