title: "invalid controlling predicate" compiler error using OpenMP
body: <p>I'm creating a basic prime number checker, based on <a href="https://stackoverflow.com/questions/1538644/c-determine-if-a-number-is-prime/1538653#1538653">C - determine if a number is prime</a>  , but utilising OpenMP. </p>
  
  <pre><code>int isPrime(int value)
  {
      omp_set_num_threads(4);
  
      #pragma omp parallel for 
      for( int j = 2;  j * j &lt;= value; j++)
      {
      if ( value % j == 0) return 0;
      }
      return value;
  }
  </code></pre>
  
  <p>When compiling with <em>-fopenmp</em>, GCC version 4.7.2 is erroring, stating <code>invalid controlling predicate</code> with respect to the for loop.</p>
  
  <p>It looks like this error is caused by the j squared in the for loop. Is there a way I can work around this and still achieve the desired output from the algorithm? </p>