title: Schrödinger bug disappearing when breakpoint is set
body: <p>I have a strange bug in my code which disappears when I try to debug it.</p>
  
  <p>In my timer interrupt (always running system ticker) I have something like this:</p>
  
  <pre><code> if (a &amp;&amp; lot &amp;&amp; of &amp;&amp; conditions)
   {
       some_global_flag = 1;                   // breakpoint 2
   }
  </code></pre>
  
  <p>in my main loop I have</p>
  
  <pre><code> if (some_global_flag)
   {
       some_global_flag = 0;
       do_something_very_important();   // breakpoint 1
   }
  </code></pre>
  
  <p>This condition in the main loop is never called when the conditions in the timer are (I think) fulfilled. The conditions are external (portpins, ADC results, etc).
  First I put a breakpoint at the position 1, and it is never triggered.</p>
  
  <p>To check it, I put breakpoint nr. 2 on the line <code>some_global_flag = 1;</code>, and in this case the code works: <strong>both</strong> breakpoints are triggered when the conditions are true.</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>To research whether some timing condition is responsible, and the <code>if</code> in the timer is never entered if running without debugging, I added the following in my timer:</p>
  
  <pre><code> if (a &amp;&amp; lot &amp;&amp; of &amp;&amp; conditions)
   {
       some_global_flag = 1;                   // breakpoint 2
   }
  
  
   if (some_global_flag)
   {
       #asm("NOP");    // breakpoint 3
   }
  </code></pre>
  
  <p>The flag is not used anywhere else in the code. It is in RAM, and the RAM is cleared to zero at the beginning.</p>
  
  <p>Now, when all the breakpoints are disabled (or only breakpoint 1 in the main is enabled), the code does not work correctly, the function is not executed. However, if I enable only the breakpoint 3 on the NOP, the code works! The breakpoint is triggered, and after continuing, the function is executed. (It has visible and audible output, so it's obvious if it runs)</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>The timer interrupt was interruptible, by means of a "SEI" at its beginning. I removed that line, but the behavior is not changed in any noticeable way.</p>
  
  <p><strong>Update 3:</strong></p>
  
  <p>I'm not using any external memory.
  As I'm very close to the limit in the flash, I have size optimization in the compiler on maximum.</p>
  
  <p><em>Can the compiler (CodeVision) be responsible, or did I do something very wrong?</em></p>