| 1 |
! REQUIRES: openmp_runtime |
| 2 |
|
| 3 |
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags |
| 4 |
! OpenMP Version 5.2 |
| 5 |
! Inherited from 2.11.3 allocate Directive |
| 6 |
! If list items within the ALLOCATE directive have the SAVE attribute, are a common block name, or are declared in the scope of a |
| 7 |
! module, then only predefined memory allocator parameters can be used in the allocator clause |
| 8 |
! SAVE and common block names can't be declared as allocatable, only module scope variables are tested |
| 9 |
|
| 10 |
module AllocateModule |
| 11 |
integer, allocatable :: a, b |
| 12 |
end module |
| 13 |
|
| 14 |
subroutine allocate() |
| 15 |
use omp_lib |
| 16 |
use AllocateModule |
| 17 |
|
| 18 |
integer(kind=omp_allocator_handle_kind) :: custom_allocator |
| 19 |
type(omp_alloctrait) :: trait(1) |
| 20 |
|
| 21 |
trait(1)%key = fallback |
| 22 |
trait(1)%value = default_mem_fb |
| 23 |
custom_allocator = omp_init_allocator(omp_default_mem_space, 1, trait) |
| 24 |
|
| 25 |
!$omp allocators allocate(omp_default_mem_alloc: a) |
| 26 |
allocate(a) |
| 27 |
|
| 28 |
!ERROR: If list items within the ALLOCATORS 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 |
| 29 |
!$omp allocators allocate(custom_allocator: b) |
| 30 |
allocate(b) |
| 31 |
end subroutine |