[flang-commits] [flang] [Flang] [Semantics] [OpenMP] Added missing semantic check with nested target region. (PR #115344)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Thu Nov 21 07:20:21 PST 2024


================
@@ -50,4 +50,28 @@ program main
   !$omp end target
   deallocate(B)
 
+  n1 = 10
+  n2 = 10
+  !$omp target teams map(to:a)
+  !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified
+  !$omp target data map(n1,n2)
+  do i=1, n1
+     do j=1, n2
+      res((i-1)*10+j) = i*j
+     end do
+  end do
+  !$omp end target data
+  !$omp end target teams
+
+  !$omp target teams map(to:a) map(from:n1,n2)
+  !PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified
+  !$omp target teams distribute parallel do
----------------
mjklemm wrote:

This would be valid code, if the inner `target` construct would have `device(ancestor)` and was compiled with `requires reverse_offload`.  See my also summary for this PR.

https://github.com/llvm/llvm-project/pull/115344


More information about the flang-commits mailing list