[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / allocate08.f90
blobfc950ea4fca36e92c2eaff4e61a6fba32d1665b9
1 ! REQUIRES: openmp_runtime
3 ! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
4 ! OpenMP Version 5.0
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
9 module AllocateModule
10 INTEGER :: z
11 end module
13 subroutine allocate()
14 use omp_lib
15 use AllocateModule
16 integer, SAVE :: x
17 integer :: w
18 COMMON /CommonName/ y
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)
32 !$omp allocate(x)
33 !$omp allocate(y)
34 !$omp allocate(z)
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