title: Why code with multiple nested loops can finish immediately on GCC but take forever on VS?
body: <pre><code>long long r = 0;
  long long k = 0;
  for (; k &lt; 9999999999999; k++) 
  {
      for (long long i = 0; i &lt; 9999999999999; i++) 
      {
          for (long long j = 0; j &lt; 9999999999999; j++) 
          {
              r = (r + (i * j) % 100) % 47;
              if (r != 0) 
              {
                  r++;
              }
          }
      }
   }
  </code></pre>
  
  <p>This code executes on i3Core in 0.000001 wall seconds, checked with <code>boost::timer::auto_cpu_timer</code> on i7Core.</p>
  
  <p>But with visual studio 2010 it seems to run in infinite time.</p>
  
  <p>What is wrong with GCC or VS ? Is GCC optimizing too much?</p>