[llvm-bugs] [Bug 45383] New: Dependencies on array elements don't work with templated index type

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 1 02:25:45 PDT 2020


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

            Bug ID: 45383
           Summary: Dependencies on array elements don't work with
                    templated index type
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: schuchart at hlrs.de
                CC: llvm-bugs at lists.llvm.org

I stumbled across a weird error Clang 9 gives me when trying to compile the
following code snippet:

```
template<typename IndexT>
void test(double *A, IndexT k)
{
  #pragma omp task depend(out: A[k])
  {
    // do something
  }
}

int driver(double *A) 
{
  int k = 0;
  test(A, k); 
  return 0;
}
```

The error:
```
$ clang++-9 test_omp_dep_template.cc -fopenmp -c
test_omp_dep_template.cc:4:34: error: expected addressable lvalue expression,
array element or array section
  #pragma omp task depend(out: A[k])
                               ~~^~
```

If I replace IndexT with int it compiles fine. I can then template the type of
A and Clang will compile fine. Compiling this with GCC works too (last time I
checked was 7.3.0).

Is this expected behavior?

-- 
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/20200401/1f46a604/attachment.html>


More information about the llvm-bugs mailing list