<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [OpenMP5.0] A worksharing region closely nested inside a worksharing region should return an error"
   href="https://bugs.llvm.org/show_bug.cgi?id=46359">46359</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[OpenMP5.0] A worksharing region closely nested inside a worksharing region should return an error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Clang Compiler Support
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sulinna@cn.fujitsu.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>According to OpenMP5.0's Restriction:

2.20  Nesting of Regions
A worksharing region may not be closely nested inside a worksharing, loop,
task, taskloop, critical, ordered, atomic, or master region.
<a href="https://www.openmp.org/spec-html/5.0/openmpse28.html#x143-6330002.20">https://www.openmp.org/spec-html/5.0/openmpse28.html#x143-6330002.20</a>


closely nested construct:
A construct nested inside another construct with no other construct nested
between them.
<a href="https://www.openmp.org/spec-html/5.0/openmpsu2.html#x9-80001.2.2">https://www.openmp.org/spec-html/5.0/openmpsu2.html#x9-80001.2.2</a>


The following examples are non-conforming because the inner and outer loop
regions are closely nested,clang should report an error for case
nesting_restrict.2.c as nesting_restrict.1.c.

These testcases are from:
<a href="https://www.openmp.org/wp-content/uploads/openmp-examples-5.0.0.pdf">https://www.openmp.org/wp-content/uploads/openmp-examples-5.0.0.pdf</a>
p378

nesting_restrict.1.c
-----------------------
void work(int i, int j) {}

void wrong1(int n)
{

  #pragma omp parallel default(shared)
  {
    int i, j;
    #pragma omp for
    for (i=0; i<n; i++) {
       /* incorrect nesting of loop regions */
       #pragma omp for
         for (j=0; j<n; j++)
           work(i, j);
    }
  }
}
------------------------

#  clang -fopenmp-version=50 -fopenmp -S Example_nesting_restrict.1.c
Example_nesting_restrict.1.c:20:8: error: region cannot be closely nested
inside 'for' region; perhaps you forget to enclose 'omp for' directive into a
parallel region?
       #pragma omp for
       ^
1 error generated.


nesting_restrict.2.c
----------------------
void work(int i, int j) {}
void work1(int i, int n)
{
  int j;
/* incorrect nesting of loop regions */
  #pragma omp for
    for (j=0; j<n; j++)
      work(i, j);
}

void wrong2(int n)
{
  #pragma omp parallel default(shared)
  {
    int i;
    #pragma omp for
      for (i=0; i<n; i++)
         work1(i, n);
  }
}
-----------------------
#  clang -fopenmp-version=50 -fopenmp -S Example_nesting_restrict.2.c</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>