diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp index 9fa7bc8964854..c2b48fe1b7887 100644 --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -2035,6 +2035,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPDispatchConstruct &x) { } bool OmpAttributeVisitor::Pre(const parser::OpenMPExecutableAllocate &x) { + IssueNonConformanceWarning(llvm::omp::Directive::OMPD_allocate, x.source); PushContext(x.source, llvm::omp::Directive::OMPD_allocate); const auto &list{std::get>(x.t)}; if (list) { @@ -3074,6 +3075,9 @@ void OmpAttributeVisitor::IssueNonConformanceWarning( case llvm::omp::OMPD_parallel_master_taskloop_simd: setAlternativeStr("PARALLEL_MASKED TASKLOOP SIMD"); break; + case llvm::omp::OMPD_allocate: + setAlternativeStr("ALLOCATORS"); + break; case llvm::omp::OMPD_target_loop: default:; } diff --git a/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 b/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 index 425ccbc5dd56c..e83b433d0fda0 100644 --- a/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 +++ b/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 @@ -1,10 +1,10 @@ ! This test checks lowering of OpenMP allocate Directive. -// RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +! RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s program main integer :: x, y - // CHECK: not yet implemented: OpenMPDeclarativeAllocate + ! CHECK: not yet implemented: OpenMPDeclarativeAllocate !$omp allocate(x, y) end diff --git a/flang/test/Semantics/OpenMP/allocate-align01.f90 b/flang/test/Semantics/OpenMP/allocate-align01.f90 index ba0776cf46a6d..4974f5e18397a 100644 --- a/flang/test/Semantics/OpenMP/allocate-align01.f90 +++ b/flang/test/Semantics/OpenMP/allocate-align01.f90 @@ -13,6 +13,7 @@ program allocate_align_tree z = 3 !ERROR: The alignment value should be a constant positive integer !$omp allocate(j) align(xx) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !ERROR: The alignment value should be a constant positive integer !$omp allocate(xarray) align(-32) allocator(omp_large_cap_mem_alloc) allocate(j(z), xarray(t)) diff --git a/flang/test/Semantics/OpenMP/allocate01.f90 b/flang/test/Semantics/OpenMP/allocate01.f90 index 6ccb8bb09e830..8a680eee743e0 100644 --- a/flang/test/Semantics/OpenMP/allocate01.f90 +++ b/flang/test/Semantics/OpenMP/allocate01.f90 @@ -19,6 +19,7 @@ subroutine sema() !$omp allocate(y) print *, a + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !ERROR: List items must be declared in the same scoping unit in which the ALLOCATE directive appears !$omp allocate(x) allocator(omp_default_mem_alloc) allocate ( x(a), darray(a, b) ) diff --git a/flang/test/Semantics/OpenMP/allocate02.f90 b/flang/test/Semantics/OpenMP/allocate02.f90 index 8f0579e810bb9..80ef60b31e700 100644 --- a/flang/test/Semantics/OpenMP/allocate02.f90 +++ b/flang/test/Semantics/OpenMP/allocate02.f90 @@ -16,9 +16,11 @@ subroutine allocate() !ERROR: At most one ALLOCATOR clause can appear on the ALLOCATE directive !$omp allocate(x, y) allocator(omp_default_mem_alloc) allocator(omp_default_mem_alloc) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate(darray) allocator(omp_default_mem_alloc) allocate ( darray(a, b) ) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !ERROR: At most one ALLOCATOR clause can appear on the ALLOCATE directive !$omp allocate(darray) allocator(omp_default_mem_alloc) allocator(omp_default_mem_alloc) allocate ( darray(a, b) ) diff --git a/flang/test/Semantics/OpenMP/allocate03.f90 b/flang/test/Semantics/OpenMP/allocate03.f90 index e35115f3897cc..b8c6b8e5dee77 100644 --- a/flang/test/Semantics/OpenMP/allocate03.f90 +++ b/flang/test/Semantics/OpenMP/allocate03.f90 @@ -18,6 +18,7 @@ subroutine allocate() !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the ALLOCATE directive !$omp allocate(my_var%array) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the ALLOCATE directive !$omp allocate(darray, my_var%array) allocator(omp_default_mem_alloc) allocate ( darray(a, b) ) diff --git a/flang/test/Semantics/OpenMP/allocate05.f90 b/flang/test/Semantics/OpenMP/allocate05.f90 index a787e8bb32a4c..2c81c4dbc82c7 100644 --- a/flang/test/Semantics/OpenMP/allocate05.f90 +++ b/flang/test/Semantics/OpenMP/allocate05.f90 @@ -13,11 +13,13 @@ subroutine allocate() real, dimension (:,:), allocatable :: darray !$omp target + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate allocator(omp_default_mem_alloc) allocate ( darray(a, b) ) !$omp end target !$omp target + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !ERROR: ALLOCATE directives that appear in a TARGET region must specify an allocator clause !$omp allocate allocate ( darray(a, b) ) diff --git a/flang/test/Semantics/OpenMP/allocate06.f90 b/flang/test/Semantics/OpenMP/allocate06.f90 index e14134cd07301..7196bcac2b9b9 100644 --- a/flang/test/Semantics/OpenMP/allocate06.f90 +++ b/flang/test/Semantics/OpenMP/allocate06.f90 @@ -14,6 +14,7 @@ subroutine allocate() !ERROR: List items specified in the ALLOCATE directive must not have the ALLOCATABLE attribute unless the directive is associated with an ALLOCATE statement !$omp allocate(darray) allocator(omp_default_mem_alloc) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate(darray) allocator(omp_default_mem_alloc) allocate(darray(a, b)) diff --git a/flang/test/Semantics/OpenMP/allocate09.f90 b/flang/test/Semantics/OpenMP/allocate09.f90 index 0f93a340fe1e4..645e97a3a33f3 100644 --- a/flang/test/Semantics/OpenMP/allocate09.f90 +++ b/flang/test/Semantics/OpenMP/allocate09.f90 @@ -12,23 +12,28 @@ subroutine allocate() integer, dimension(:), allocatable :: a, b, c, d, e, f, & g, h, i, j, k, l + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate(a) allocator(omp_default_mem_alloc) allocate(a(1), b(2)) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate(c, d) allocator(omp_default_mem_alloc) allocate(c(3), d(4)) !$omp allocate(e) allocator(omp_default_mem_alloc) !$omp allocate(f, g) allocator(omp_default_mem_alloc) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate allocate(e(5), f(6), g(7)) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !ERROR: Object 'i' in ALLOCATE directive not found in corresponding ALLOCATE statement !$omp allocate(h, i) allocator(omp_default_mem_alloc) allocate(h(8)) !ERROR: Object 'j' in ALLOCATE directive not found in corresponding ALLOCATE statement !$omp allocate(j, k) allocator(omp_default_mem_alloc) + !WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. !$omp allocate(l) allocator(omp_default_mem_alloc) allocate(k(9), l(10))