Author: Krzysztof Parzyszek Date: 2026-01-23T07:29:40Z New Revision: 3e421eea2625050fdbec22aeaeb6b1a1be89d9d3
URL: https://github.com/llvm/llvm-project/commit/3e421eea2625050fdbec22aeaeb6b1a1be89d9d3 DIFF: https://github.com/llvm/llvm-project/commit/3e421eea2625050fdbec22aeaeb6b1a1be89d9d3.diff LOG: [flang][OpenMP] Allow ALLOC/RELEASE in place of STORAGE in 6.0 (#176810) As per the 6.0 spec > The value alloc may be used on map-entering constructs and the value > release may be used on map-exiting constructs with identical meaning to > the value storage. (cherry picked from commit eb7adafc68dcf5a86ce916d93df6a1e34fbb9688) Added: Modified: flang/lib/Semantics/check-omp-structure.cpp flang/test/Semantics/OpenMP/map-clause-v60.f90 Removed: ################################################################################ diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 7c7379d125f29..9f4825cfd641e 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 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
