<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 - Fail to compile OpenMP array reduction"
   href="https://bugs.llvm.org/show_bug.cgi?id=39084">39084</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Fail to compile OpenMP array reduction
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>james.h.cownie@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>OpenMP 4.5 includes reductions on array sections, which should allow code like
this to work

int myroutine(double *a, double *sum, int n)
{
    int i;

#pragma omp for reduction(+:sum[:1])
    for(i=0;i<n;i++){
        sum[0] += a[i];
    }

    return 0;
}

However, clang objects to this because it cannot prove that *a is shared.
GCC however accepts it <a href="https://godbolt.org/z/4JwPYu">https://godbolt.org/z/4JwPYu</a> , and it is useful. (See
<a href="https://stackoverflow.com/questions/52333881/is-it-possible-to-use-a-reduction-variable-from-a-passed-by-pointer-argument-ins/">https://stackoverflow.com/questions/52333881/is-it-possible-to-use-a-reduction-variable-from-a-passed-by-pointer-argument-ins/</a>
for instance).

We should accept it as well. 
(There may be a clarification in OpenMP 5.0 that this should be legal. Even if
such a clarification is not forthcoming, not allowing it sees perverse.)</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>