| 1 |
module my_omp_lib |
| 2 |
use iso_c_binding, only: c_intptr_t |
| 3 |
!use omp_lib |
| 4 |
implicit none |
| 5 |
integer, parameter :: omp_allocator_handle_kind = c_intptr_t |
| 6 |
|
| 7 |
integer (kind=omp_allocator_handle_kind), & |
| 8 |
parameter :: omp_null_allocator = 0 |
| 9 |
|
| 10 |
integer (kind=omp_allocator_handle_kind), & |
| 11 |
parameter :: omp_default_mem_alloc = 1 |
| 12 |
integer (kind=omp_allocator_handle_kind), & |
| 13 |
parameter :: omp_large_cap_mem_alloc = 2 |
| 14 |
integer (kind=omp_allocator_handle_kind), & |
| 15 |
parameter :: omp_const_mem_alloc = 3 |
| 16 |
integer (kind=omp_allocator_handle_kind), & |
| 17 |
parameter :: omp_high_bw_mem_alloc = 4 |
| 18 |
integer (kind=omp_allocator_handle_kind), & |
| 19 |
parameter :: omp_low_lat_mem_alloc = 5 |
| 20 |
integer (kind=omp_allocator_handle_kind), & |
| 21 |
parameter :: omp_cgroup_mem_alloc = 6 |
| 22 |
integer (kind=omp_allocator_handle_kind), & |
| 23 |
parameter :: omp_pteam_mem_alloc = 7 |
| 24 |
integer (kind=omp_allocator_handle_kind), & |
| 25 |
parameter :: omp_thread_mem_alloc = 8 |
| 26 |
type t |
| 27 |
integer,allocatable :: a |
| 28 |
integer,pointer :: b(:,:) |
| 29 |
end type t |
| 30 |
end module my_omp_lib |
| 31 |
|
| 32 |
subroutine zero() |
| 33 |
!$omp assumes absent (allocate) ! { dg-error "Invalid 'ALLOCATE' directive at .1. in ABSENT clause: declarative, informational, and meta directives not permitted" } |
| 34 |
|
| 35 |
!$omp assume absent (allocate) ! { dg-error "Invalid 'ALLOCATE' directive at .1. in ABSENT clause: declarative, informational, and meta directives not permitted" } |
| 36 |
!!$omp end assume |
| 37 |
end |
| 38 |
|
| 39 |
subroutine alloc(c,x2,y2) |
| 40 |
use my_omp_lib |
| 41 |
implicit none |
| 42 |
integer, allocatable :: a, b(:), c(:,:) |
| 43 |
type(t) :: x1,x2 |
| 44 |
class(t) :: y1,y2 |
| 45 |
allocatable :: x1, y1 |
| 46 |
|
| 47 |
!$omp flush ! some executable statement |
| 48 |
|
| 49 |
!$omp allocate(x2%a,x2%b,y2%a,y2%b) allocator(omp_pteam_mem_alloc) align(64) ! { dg-error "Sorry, structure-element list item at .1. in ALLOCATE directive is not yet supported" } |
| 50 |
allocate(x2%a,x2%b(3,4),y2%a,y2%b(3,4)) |
| 51 |
|
| 52 |
!$omp allocate(b(3)) align ( 64 ) ! { dg-error "Unexpected expression as list item at .1. in ALLOCATE directive" } |
| 53 |
allocate(b(3)) |
| 54 |
end |
| 55 |
|
| 56 |
subroutine one(n, my_alloc) |
| 57 |
use my_omp_lib |
| 58 |
implicit none |
| 59 |
integer :: n |
| 60 |
integer(kind=omp_allocator_handle_kind), intent(in) :: my_alloc |
| 61 |
|
| 62 |
integer :: a,b,c(n),d(5),e(2) |
| 63 |
integer, save :: k,l,m(5),r(2) |
| 64 |
integer :: q,x,y(2),z(5) |
| 65 |
common /com1/ q,x |
| 66 |
common /com2/ y,z |
| 67 |
integer, allocatable :: alloc |
| 68 |
integer, pointer :: ptr |
| 69 |
|
| 70 |
!$omp allocate(q) ! { dg-error "'q' at .1. is part of the common block '/com1/' and may only be specificed implicitly via the named common block" } |
| 71 |
|
| 72 |
!$omp allocate(d(:)) ! { dg-error "Unexpected expression as list item at .1. in ALLOCATE directive" } |
| 73 |
!$omp allocate(a) align(4), align(4) ! { dg-error "Duplicated 'align' clause" } |
| 74 |
!$omp allocate( e ) allocator( omp_high_bw_mem_alloc ), align(32),allocator( omp_high_bw_mem_alloc ) ! { dg-error "Duplicated 'allocator' clause" } |
| 75 |
|
| 76 |
!$omp allocate align(32) ! { dg-error "'!.OMP ALLOCATE' directive at .1. must either have a variable argument or, if associated with an ALLOCATE stmt, must be preceded by an executable statement or OpenMP construct" } |
| 77 |
|
| 78 |
!$omp allocate(alloc) align(128) ! { dg-error "'!.OMP ALLOCATE' directive at .1. associated with an ALLOCATE stmt must be preceded by an executable statement or OpenMP construct; note the variables in the list all have the allocatable or pointer attribute" } |
| 79 |
!$omp allocate(ptr) align(128) ! { dg-error "'!.OMP ALLOCATE' directive at .1. associated with an ALLOCATE stmt must be preceded by an executable statement or OpenMP construct; note the variables in the list all have the allocatable or pointer attribute" } |
| 80 |
|
| 81 |
!$omp allocate(e) allocate(omp_thread_mem_alloc) ! { dg-error "Expected ALIGN or ALLOCATOR clause" } |
| 82 |
end |
| 83 |
|
| 84 |
subroutine two() |
| 85 |
integer, allocatable :: a,b,c |
| 86 |
|
| 87 |
call foo() |
| 88 |
!$omp allocate(a) |
| 89 |
a = 5 ! { dg-error "Unexpected assignment at .1.; expected ALLOCATE or !.OMP ALLOCATE statement" } |
| 90 |
|
| 91 |
!$omp allocate ! { dg-error "!.OMP ALLOCATE statements at .1. and .2. have both no list item but only one may" } |
| 92 |
!$omp allocate(b) |
| 93 |
!$omp allocate ! { dg-error "!.OMP ALLOCATE statements at .1. and .2. have both no list item but only one may" } |
| 94 |
allocate(a,b,c) |
| 95 |
|
| 96 |
!$omp allocate |
| 97 |
allocate(a,b,c) ! allocate is no block construct, hence: |
| 98 |
!$omp end allocate ! { dg-error "Unclassifiable OpenMP directive" } |
| 99 |
|
| 100 |
!$omp allocators allocate(align(64) : a, b) |
| 101 |
!$omp allocators allocate(align(128) : c) ! { dg-error "Unexpected !.OMP ALLOCATORS at .1.; expected ALLOCATE statement after !.OMP ALLOCATORS" } |
| 102 |
allocate(a,b,c) |
| 103 |
end |