<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 - OpenMP: array element not allowed in reduction clause"
   href="https://bugs.llvm.org/show_bug.cgi?id=45717">45717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>OpenMP: array element not allowed in reduction clause
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>david.pagan@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compiler generates an error when array element is referred to in a reduction
clause. Spec seems to say this is valid, and other compilers accept it.

Test case:

static short x[100];
static short y[100];
static const int N = 100;

void test() {

    short (*yptr)[N] = &y;
#pragma omp parallel for simd reduction(+:yptr[0])
   for(int i = 0; i < N; i++) {
       yptr[0][25 + i/4] += x[i];
   }
}

Compile: clang -fopenmp test.cpp

Error:

test.cpp:8:43: error: list item of type 'int [100]' is not valid for specified
reduction operation: unable to provide default initialization value
#pragma omp parallel for simd reduction(+:yptr[0])
                                        ~ ^
test.cpp:7:11: note: 'yptr' defined here
    int (*yptr)[N] = &y;
          ^
1 error generated.</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>