jhuber6 added a comment.

This revision causes a bug with generic regions. Firstprivate constants now 
aren't mapped properly into an internal parallel region and will just be zero. 
For example if I run this code I will see different values for the constants 
inside and outside the parallel region.

  #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

I'm assuming they aren't being properly copied because they were originally 
global constants that had visibility everywhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105375/new/

https://reviews.llvm.org/D105375

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to