llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: None (llvmbot)

<details>
<summary>Changes</summary>

Backport eb7adafc68dcf5a86ce916d93df6a1e34fbb9688

Requested by: @<!-- -->kparzysz

---
Full diff: https://github.com/llvm/llvm-project/pull/176942.diff


2 Files Affected:

- (modified) flang/lib/Semantics/check-omp-structure.cpp (+6-4) 
- (modified) flang/test/Semantics/OpenMP/map-clause-v60.f90 (+27) 


``````````diff
diff --git a/flang/lib/Semantics/check-omp-structure.cpp 
b/flang/lib/Semantics/check-omp-structure.cpp
index 2acf0dee1f77e..44cb3c06936f7 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -4300,10 +4300,11 @@ void OmpStructureChecker::Enter(const 
parser::OmpClause::Map &x) {
     static auto isValidForVersion{
         [](parser::OmpMapType::Value t, unsigned version) {
           switch (t) {
-          case parser::OmpMapType::Value::Alloc:
           case parser::OmpMapType::Value::Delete:
-          case parser::OmpMapType::Value::Release:
             return version < 60;
+          case parser::OmpMapType::Value::Alloc:
+          case parser::OmpMapType::Value::Release:
+            return version <= 60;
           case parser::OmpMapType::Value::Storage:
             return version >= 60;
           default:
@@ -4336,8 +4337,9 @@ void OmpStructureChecker::Enter(const 
parser::OmpClause::Map &x) {
         llvm::is_contained(leafs, Directive::OMPD_target_data)) {
       if (version >= 60) {
         // Map types listed in the decay table. [6.0:276]
-        CheckAllowedMapTypes(
-            type->v, {Value::Storage, Value::From, Value::To, Value::Tofrom});
+        CheckAllowedMapTypes(type->v,
+            {Value::Alloc, Value::Release, Value::Storage, Value::From,
+                Value::To, Value::Tofrom});
       } else {
         CheckAllowedMapTypes(
             type->v, {Value::Alloc, Value::From, Value::To, Value::Tofrom});
diff --git a/flang/test/Semantics/OpenMP/map-clause-v60.f90 
b/flang/test/Semantics/OpenMP/map-clause-v60.f90
index 2c73f2edaa6b0..7327f930e234a 100644
--- a/flang/test/Semantics/OpenMP/map-clause-v60.f90
+++ b/flang/test/Semantics/OpenMP/map-clause-v60.f90
@@ -6,3 +6,30 @@ subroutine f00(a)
   !$omp target map(a)
   !$omp end target
 end
+
+subroutine f01
+  integer :: x
+  ! No diagnostic expected, alloc is allowed on map-entering constructs
+  !$omp target map(alloc: x)
+  !$omp end target
+end
+
+subroutine f02
+  integer :: x
+  ! No diagnostic expected, release is allowed on map-exiting constructs
+  !$omp target_data map(release: x)
+  !$omp end target_data
+end
+
+subroutine f03
+  integer :: x
+  ! No diagnostic expected, delete is its own modifier in 6.0+
+  !$omp target_data map(delete: x)
+  !$omp end target_data
+end
+
+subroutine f04
+  integer :: x
+  !ERROR: Only the FROM, RELEASE, STORAGE, TOFROM map types are permitted for 
MAP clauses on the TARGET_EXIT_DATA directive
+  !$omp target_exit_data map(alloc: x)
+end

``````````

</details>


https://github.com/llvm/llvm-project/pull/176942
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to