[llvm-bugs] [Bug 47621] New: Variable used by task inside a template function is not made firstprivate by default

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 22 20:45:58 PDT 2020


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

            Bug ID: 47621
           Summary: Variable used by task inside a template function is
                    not made firstprivate by default
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fmorac at udel.edu
                CC: llvm-bugs at lists.llvm.org

Created attachment 23992
  --> https://bugs.llvm.org/attachment.cgi?id=23992&action=edit
Full test

Description:
  Variable used by a task region inside a template function is not made 
firstprivate by default as per defined in the OpenMP specification at the end
of section 2.19.1.1.

Extract from test.cpp where the bug is located:
====================================================================
template <typename T = void> int template_test(int n) {
  std::vector<int> values(n, 0);
#pragma omp parallel
  {
#pragma omp single
    {
      for (int i = 0; i < n; ++i)
#pragma omp task
        values[i] = i;
    }
  }
  int diffs = 0;
  for (int i = 0; i < n; ++i)
    if (values[i] != i)
      ++diffs;
  return diffs;
}
====================================================================
The expected return value for the template_test function is 0.

Expected test results:
====================================================================
Non-template test:                           PASS
Template test:                               PASS
Template test with first-private clause:     PASS
====================================================================

Tested compilers:
  clang-9, clang-10, clang-12

Compilers where the bug can be found:
  clang-9, clang-10, clang-12

Testing platform:
  Debian testing, Ubuntu Bionic Beaver

Current test results:
====================================================================
Non-template test:                           PASS
Template test:                               FAIL
Template test with first-private clause:     PASS
====================================================================

Steps to reproduce:
  1. clang++ -fopenmp test.cpp -o test
  2. ./test

Related bug: 
  https://bugs.llvm.org/show_bug.cgi?id=39422

-- 
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/20200923/228bf9cc/attachment.html>


More information about the llvm-bugs mailing list