Issue 233500
Summary [OpenMP] firstprivate of a structured binding on 'target nowait' is not captured when the construct is encountered.
Labels clang:codegen, clang:openmp
Assignees zahiraam
Reporter zahiraam
    With `firstprivate(a)` on a deferred target task, where `a` is a structured binding, the target region reads `a` from the decomposed object when the task
runs, instead of from the value captured when the construct is encountered.

```cpp
struct Point { int x, y; };

void with_binding() {
  Point p{1, 2};
  auto [a, b] = p;
#pragma omp target nowait firstprivate(a)
  { a++; }
}

void with_plain_int() {
  Point p{1, 2};
 int a = p.x;
#pragma omp target nowait firstprivate(a)
  { a++; }
}
```

```
clang -fopenmp -fopenmp-version=60 -emit-llvm -g0 -std=c++20 -S test.cpp -o -
clang -fopenmp -fopenmp-version=60 -emit-llvm -g0 -std=c++20   -fopenmp-targets=x86_64-pc-linux-gnu -S test.cpp -o -
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to