Skip to content

Commit 66f1fa9

Browse files
committed
Remove deprecation warning for OpenMPDeclarativeAllocate
As per the spec for OpenMP 5.2, it is only when the allocate directive is followed by an allocate statement that has been deprecated. This commit removes the deprecation for the declarative version of `allocate`, and updates the appropriate tests to accomodate this.
1 parent 7ee8549 commit 66f1fa9

File tree

12 files changed

+1
-33
lines changed

12 files changed

+1
-33
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,6 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPThreadprivate &x) {
20242024

20252025
bool OmpAttributeVisitor::Pre(const parser::OpenMPDeclarativeAllocate &x) {
20262026
PushContext(x.source, llvm::omp::Directive::OMPD_allocate);
2027-
IssueNonConformanceWarning(llvm::omp::Directive::OMPD_allocate, x.source);
20282027
const auto &list{std::get<parser::OmpObjectList>(x.t)};
20292028
ResolveOmpObjectList(list, Symbol::Flag::OmpDeclarativeAllocateDirective);
20302029
return false;
@@ -2036,8 +2035,8 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPDispatchConstruct &x) {
20362035
}
20372036

20382037
bool OmpAttributeVisitor::Pre(const parser::OpenMPExecutableAllocate &x) {
2039-
PushContext(x.source, llvm::omp::Directive::OMPD_allocate);
20402038
IssueNonConformanceWarning(llvm::omp::Directive::OMPD_allocate, x.source);
2039+
PushContext(x.source, llvm::omp::Directive::OMPD_allocate);
20412040
const auto &list{std::get<std::optional<parser::OmpObjectList>>(x.t)};
20422041
if (list) {
20432042
ResolveOmpObjectList(*list, Symbol::Flag::OmpExecutableAllocateDirective);

flang/test/Lower/OpenMP/Todo/omp-declarative-allocate-align.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
program main
66
integer :: x
77

8-
! CHECK: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
98
! CHECK: not yet implemented: OpenMPDeclarativeAllocate
109
!$omp allocate(x) align(32)
1110
end

flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
program main
66
integer :: x, y
77

8-
! CHECK: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
98
! CHECK: not yet implemented: OpenMPDeclarativeAllocate
109
!$omp allocate(x, y)
1110
end

flang/test/Semantics/OpenMP/allocate-align01.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ program allocate_align_tree
1111
integer :: z, t, xx
1212
t = 2
1313
z = 3
14-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1514
!ERROR: The alignment value should be a constant positive integer
1615
!$omp allocate(j) align(xx)
1716
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.

flang/test/Semantics/OpenMP/allocate01.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ subroutine sema()
1515
integer :: a, b
1616
real, dimension (:,:), allocatable :: darray
1717

18-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1918
!ERROR: List items must be declared in the same scoping unit in which the ALLOCATE directive appears
2019
!$omp allocate(y)
2120
print *, a

flang/test/Semantics/OpenMP/allocate02.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ subroutine allocate()
1111
integer :: a, b
1212
real, dimension (:,:), allocatable :: darray
1313

14-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1514
!$omp allocate(x, y) allocator(omp_default_mem_alloc)
1615

17-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1816
!ERROR: At most one ALLOCATOR clause can appear on the ALLOCATE directive
1917
!$omp allocate(x, y) allocator(omp_default_mem_alloc) allocator(omp_default_mem_alloc)
2018

flang/test/Semantics/OpenMP/allocate03.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ subroutine allocate()
1515
real, dimension (:,:), allocatable :: darray
1616
integer :: a, b
1717

18-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1918
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the ALLOCATE directive
2019
!$omp allocate(my_var%array)
2120

flang/test/Semantics/OpenMP/allocate04.f90

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,14 @@ subroutine allocate(z)
1515
integer :: x, y, z
1616

1717
associate (a => x)
18-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1918
!$omp allocate(x) allocator(omp_default_mem_alloc)
2019

21-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2220
!ERROR: PRIVATE clause is not allowed on the ALLOCATE directive
2321
!$omp allocate(y) private(y)
24-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2522
!ERROR: List item 'z' in ALLOCATE directive must not be a dummy argument
2623
!$omp allocate(z)
27-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2824
!ERROR: List item 'p' in ALLOCATE directive must not have POINTER attribute
2925
!$omp allocate(p)
30-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3126
!ERROR: List item 'a' in ALLOCATE directive must not be an associate name
3227
!$omp allocate(a)
3328
end associate

flang/test/Semantics/OpenMP/allocate06.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ subroutine allocate()
1111
integer :: a, b, x
1212
real, dimension (:,:), allocatable :: darray
1313

14-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
1514
!ERROR: List items specified in the ALLOCATE directive must not have the ALLOCATABLE attribute unless the directive is associated with an ALLOCATE statement
1615
!$omp allocate(darray) allocator(omp_default_mem_alloc)
1716

flang/test/Semantics/OpenMP/allocate07.f90

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,18 @@ subroutine allocate()
1818
CHARACTER(LEN=32) :: w
1919
INTEGER, DIMENSION(:), ALLOCATABLE :: y
2020

21-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2221
!ERROR: A type parameter inquiry cannot appear on the ALLOCATE directive
2322
!$omp allocate(x%KIND)
2423

25-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2624
!ERROR: A type parameter inquiry cannot appear on the ALLOCATE directive
2725
!$omp allocate(w%LEN)
2826

29-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3027
!ERROR: A type parameter inquiry cannot appear on the ALLOCATE directive
3128
!$omp allocate(y%KIND)
3229

33-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3430
!ERROR: A type parameter inquiry cannot appear on the ALLOCATE directive
3531
!$omp allocate(my_var%kind_param)
3632

37-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3833
!ERROR: A type parameter inquiry cannot appear on the ALLOCATE directive
3934
!$omp allocate(my_var%len_param)
4035

flang/test/Semantics/OpenMP/allocate08.f90

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,20 @@ subroutine allocate()
2525
trait(1)%value = default_mem_fb
2626
custom_allocator = omp_init_allocator(memspace, 1, trait)
2727

28-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2928
!$omp allocate(x) allocator(omp_default_mem_alloc)
30-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3129
!$omp allocate(y) allocator(omp_default_mem_alloc)
32-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3330
!$omp allocate(z) allocator(omp_default_mem_alloc)
3431

35-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3632
!$omp allocate(x)
37-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3833
!$omp allocate(y)
39-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
4034
!$omp allocate(z)
4135

42-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
4336
!$omp allocate(w) allocator(custom_allocator)
4437

45-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
4638
!ERROR: If list items within the ALLOCATE directive have the SAVE attribute, are a common block name, or are declared in the scope of a module, then only predefined memory allocator parameters can be used in the allocator clause
4739
!$omp allocate(x) allocator(custom_allocator)
48-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
4940
!ERROR: If list items within the ALLOCATE directive have the SAVE attribute, are a common block name, or are declared in the scope of a module, then only predefined memory allocator parameters can be used in the allocator clause
5041
!$omp allocate(y) allocator(custom_allocator)
51-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
5242
!ERROR: If list items within the ALLOCATE directive have the SAVE attribute, are a common block name, or are declared in the scope of a module, then only predefined memory allocator parameters can be used in the allocator clause
5343
!$omp allocate(z) allocator(custom_allocator)
5444
end subroutine allocate

flang/test/Semantics/OpenMP/allocate09.f90

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ subroutine allocate()
2020
!$omp allocate(c, d) allocator(omp_default_mem_alloc)
2121
allocate(c(3), d(4))
2222

23-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2423
!$omp allocate(e) allocator(omp_default_mem_alloc)
25-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2624
!$omp allocate(f, g) allocator(omp_default_mem_alloc)
2725
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
2826
!$omp allocate
@@ -33,7 +31,6 @@ subroutine allocate()
3331
!$omp allocate(h, i) allocator(omp_default_mem_alloc)
3432
allocate(h(8))
3533

36-
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
3734
!ERROR: Object 'j' in ALLOCATE directive not found in corresponding ALLOCATE statement
3835
!$omp allocate(j, k) allocator(omp_default_mem_alloc)
3936
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.

0 commit comments

Comments
 (0)