1 ! REQUIRES: openmp_runtime
3 ! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
5 ! 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
20 integer(kind
=omp_allocator_handle_kind
) :: custom_allocator
21 integer(kind
=omp_memspace_handle_kind
) :: memspace
22 type(omp_alloctrait
), dimension(1) :: trait
23 memspace
= omp_default_mem_space
24 trait(1)%key = fallback
25 trait(1)%value
= default_mem_fb
26 custom_allocator
= omp_init_allocator(memspace
, 1, trait
)
28 !$omp allocate(x) allocator(omp_default_mem_alloc)
29 !$omp allocate(y) allocator(omp_default_mem_alloc)
30 !$omp allocate(z) allocator(omp_default_mem_alloc)
36 !$omp allocate(w) allocator(custom_allocator)
38 !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
39 !$omp allocate(x) allocator(custom_allocator)
40 !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
41 !$omp allocate(y) allocator(custom_allocator)
42 !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
43 !$omp allocate(z) allocator(custom_allocator)
44 end subroutine allocate