[llvm-bugs] [Bug 46359] New: [OpenMP5.0] A worksharing region closely nested inside a worksharing region should return an error

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 16 20:23:27 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46359

            Bug ID: 46359
           Summary: [OpenMP5.0] A worksharing region closely nested inside
                    a worksharing region should return an error
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sulinna at cn.fujitsu.com
                CC: llvm-bugs at lists.llvm.org

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.
https://www.openmp.org/spec-html/5.0/openmpse28.html#x143-6330002.20


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


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:
https://www.openmp.org/wp-content/uploads/openmp-examples-5.0.0.pdf
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200617/6dc8c641/attachment.html>


More information about the llvm-bugs mailing list