title: OpenMP causes internal compiler error
body: <p>I wrote a little program to test the performance gain of OpenMP.
  I compile using Microsoft Visual Studio.</p>
  
  <pre><code>void findAllPrimesUntilX() {
      for (int i = 2; i &lt;= upToXthPrimes; i++) {
          if (i % 500 == 0) std::cout &lt;&lt; "First " &lt;&lt; i * 500 &lt;&lt; "primes have been checked\n";
          if (checkPrime(i)) primes.push_back(i);
      }
      std::cout &lt;&lt; "All primes have been calculated!\n";
  }
  </code></pre>
  
  <p>this is the function calling "checkPrime(i)" which looks like this:</p>
  
  <pre><code>bool checkPrime(int n) {
      if (n == 2) return true;
      if (n &lt; 2 || n % 2 == 0) return false;      
  #pragma omp parallel for
          for (int i = 3; i &lt;= static_cast&lt;int&gt;(sqrt(n)); i += 2) {
              if (n % i == 0) return false;
          }
          return true;        
  }
  </code></pre>
  
  <p>I am now getting a "C1001 Error : An internal error has occured in the compiler."</p>
  
  <p>Removing the #pragma omp parallel for solves this problem. So what's the deal?</p>
  
  <p>Thanks in advance</p>
  
  <p>Folling</p>