title: GCC 5.1 warns cancel construct within `parallel for` construct
body: <p>When I use <code>cancel</code> directive (since OpenMP 4.0) to break parallel loop within <code>parallel for</code> construct, GCC 5.1 warns "'#pragma omp cancel for' inside 'nowait' for construct" for the following snippet.</p>
  
  <pre><code>const int N = 10000;
  
  int main()
  {
    #pragma omp parallel for
    for (int i = 0; i &lt; N; i++) {
      #pragma omp cancel for  // &lt;-- here
    }
  }
  </code></pre>
  
  <p><a href="http://coliru.stacked-crooked.com/a/de5c52da5a16c154">http://coliru.stacked-crooked.com/a/de5c52da5a16c154</a></p>
  
  <p>For workaround, when I split to <code>parallel</code> + <code>for</code> constructs, GCC accepts the code silently.</p>
  
  <pre><code>int main()
  {
    #pragma omp parallel
    #pragma omp for
    for (int i = 0; i &lt; N; i++) {
      #pragma omp cancel for
    }
  }
  </code></pre>
  
  <p>But I don't know why GCC warns the former case, nevertheless the construct has no 'nowait' clause.
  <a href="http://www.openmp.org/mp-documents/OpenMP4.0.0.pdf">OpenMP 4.0 API spec</a> also says that <code>parallel for</code> is equal to <code>parallel</code> + <code>for</code> constructs.</p>
  
  <blockquote>
    <p>2.10.1 Parallel Loop Construct</p>
    
    <p>Description</p>
    
    <p>The semantics are identical to explicitly specifying a <code>parallel</code> directive immediately followed by a <code>for</code> directive.</p>
  </blockquote>
  
  <p>Is GCC's behavior correct? or something wrong?</p>