[llvm-bugs] [Bug 45717] New: OpenMP: array element not allowed in reduction clause

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 28 09:23:03 PDT 2020


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

            Bug ID: 45717
           Summary: OpenMP: array element not allowed in reduction clause
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.pagan at intel.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
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/20200428/0ed9be5b/attachment.html>


More information about the llvm-bugs mailing list