[llvm-bugs] [Bug 51028] New: Constant firstprivate argument in target region not passed correctly to parallel region

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 8 09:34:37 PDT 2021


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

            Bug ID: 51028
           Summary: Constant firstprivate argument in target region not
                    passed correctly to parallel region
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenMP
          Assignee: a.bataev at hotmail.com
          Reporter: huberjn at ornl.gov
                CC: llvm-bugs at lists.llvm.org

Any constant non-scalar data type that is mapped firstprivate into a target
region will not be correctly copied to the parallel region if executing in
generic mode. This regression was caused by D105375. Here is a small
reproducer.

#include <complex>
#include <cstdio>

void foo(const std::complex<double> X, std::complex<double> Y) {
#pragma omp target firstprivate(X) map(from:Y)
  {
    printf ("Outside parallel: %f + %fi\n", X.real(), X.imag());
#pragma omp parallel firstprivate(X)
    {
      printf ("Inside parallel: %f + %fi\n", X.real(), X.imag());
      Y = X;
    }
  }
}

int main() {
  std::complex<double> X = {1.0, 1.0};
  std::complex<double> Y;
  foo(X, Y);
}

Outside parallel: 1.000000 + 1.000000i
Inside parallel: 0.000000 + 0.000000i

-- 
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/20210708/19d340b8/attachment.html>


More information about the llvm-bugs mailing list