| 1 |
! { dg-additional-options "-fmax-errors=1000" } |
| 2 |
module my_omp_lib |
| 3 |
use iso_c_binding, only: c_intptr_t |
| 4 |
!use omp_lib |
| 5 |
implicit none |
| 6 |
integer, parameter :: omp_allocator_handle_kind = c_intptr_t |
| 7 |
|
| 8 |
integer (kind=omp_allocator_handle_kind), & |
| 9 |
parameter :: omp_null_allocator = 0 |
| 10 |
|
| 11 |
integer (kind=omp_allocator_handle_kind), & |
| 12 |
parameter :: omp_default_mem_alloc = 1 |
| 13 |
integer (kind=omp_allocator_handle_kind), & |
| 14 |
parameter :: omp_large_cap_mem_alloc = 2 |
| 15 |
integer (kind=omp_allocator_handle_kind), & |
| 16 |
parameter :: omp_const_mem_alloc = 3 |
| 17 |
integer (kind=omp_allocator_handle_kind), & |
| 18 |
parameter :: omp_high_bw_mem_alloc = 4 |
| 19 |
integer (kind=omp_allocator_handle_kind), & |
| 20 |
parameter :: omp_low_lat_mem_alloc = 5 |
| 21 |
integer (kind=omp_allocator_handle_kind), & |
| 22 |
parameter :: omp_cgroup_mem_alloc = 6 |
| 23 |
integer (kind=omp_allocator_handle_kind), & |
| 24 |
parameter :: omp_pteam_mem_alloc = 7 |
| 25 |
integer (kind=omp_allocator_handle_kind), & |
| 26 |
parameter :: omp_thread_mem_alloc = 8 |
| 27 |
type t |
| 28 |
integer,allocatable :: a |
| 29 |
integer,pointer :: b(:,:) |
| 30 |
end type t |
| 31 |
integer :: used |
| 32 |
end module my_omp_lib |
| 33 |
|
| 34 |
subroutine one(n, my_alloc) |
| 35 |
use my_omp_lib |
| 36 |
implicit none |
| 37 |
integer :: n |
| 38 |
integer(kind=omp_allocator_handle_kind), intent(in) :: my_alloc |
| 39 |
|
| 40 |
integer :: a,b,c(n),d(5),e(2) |
| 41 |
integer, save :: k,l,m(5),r(2) |
| 42 |
integer :: q,x,y(2),z(5) |
| 43 |
common /com1/ q,x |
| 44 |
common /com2/ y,z |
| 45 |
integer, allocatable :: alloc |
| 46 |
integer, pointer :: ptr |
| 47 |
integer, parameter :: prm=5 |
| 48 |
|
| 49 |
!$omp allocate(prm) align(64) ! { dg-error "Argument 'prm' at .1. to declarative !.OMP ALLOCATE directive must be a variable" } |
| 50 |
|
| 51 |
!$omp allocate(used) allocator(omp_pteam_mem_alloc) ! { dg-error "Argument 'used' at .1. to declarative !.OMP ALLOCATE shall be in the same scope as the variable declaration" } |
| 52 |
!$omp allocate(n) allocator(omp_pteam_mem_alloc) ! { dg-error "Unexpected dummy argument 'n' as argument at .1. to declarative !.OMP ALLOCATE" } |
| 53 |
|
| 54 |
!$omp allocate (x) align(128) ! { dg-error "'x' at .1. is part of the common block '/com1/' and may only be specificed implicitly via the named common block" } |
| 55 |
|
| 56 |
!$omp allocate (a, b, a) allocator (omp_pteam_mem_alloc) ! { dg-error "Duplicated variable 'a' in !.OMP ALLOCATE" } |
| 57 |
contains |
| 58 |
|
| 59 |
subroutine inner |
| 60 |
!$omp allocate(a) allocator(omp_pteam_mem_alloc) ! { dg-error "Argument 'a' at .1. to declarative !.OMP ALLOCATE shall be in the same scope as the variable declaration" } |
| 61 |
end |
| 62 |
end |
| 63 |
|
| 64 |
subroutine three(n) |
| 65 |
use my_omp_lib |
| 66 |
implicit none |
| 67 |
integer,value :: n |
| 68 |
integer :: a,b,c(n),d(5),e(2) |
| 69 |
integer, save :: k,l,m(5) |
| 70 |
integer :: q,x,y(2),z(5),r |
| 71 |
common /com4/ y,z |
| 72 |
allocatable :: q |
| 73 |
pointer :: b |
| 74 |
!$omp allocate (c, d) allocator (omp_pteam_mem_alloc) |
| 75 |
!$omp allocate (/com4/) allocator (omp_pteam_mem_alloc) |
| 76 |
!$omp allocate (c) allocator (omp_pteam_mem_alloc) ! { dg-error "Duplicated variable 'c' in !.OMP ALLOCATE" } |
| 77 |
!$omp allocate (/com4/) allocator (omp_pteam_mem_alloc) ! { dg-error "Duplicated common block '/com4/' in !.OMP ALLOCATE" } |
| 78 |
|
| 79 |
!$omp allocate(q,x) ! { dg-error "Unexpected allocatable variable 'q' at .1. in declarative !.OMP ALLOCATE directive" } |
| 80 |
!$omp allocate(b,e) ! { dg-error "Unexpected pointer variable 'b' at .1. in declarative !.OMP ALLOCATE directive" } |
| 81 |
end |
| 82 |
|
| 83 |
subroutine four(n) |
| 84 |
integer :: qq, rr, ss, tt, uu, vv,n |
| 85 |
!$omp allocate (qq) align(3+n) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 86 |
!$omp allocate (rr) align([4]) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 87 |
!$omp allocate (ss) align([4]) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 88 |
!$omp allocate (tt) align(32.0) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 89 |
!$omp allocate (uu) align(31) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 90 |
end |
| 91 |
|
| 92 |
subroutine five(n,my_alloc) |
| 93 |
use my_omp_lib |
| 94 |
implicit none |
| 95 |
integer :: qq, rr, ss, tt, uu, vv,n |
| 96 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 97 |
!$omp allocate (qq) allocator(3.0) ! { dg-error "Expected integer expression of the 'omp_allocator_handle_kind' kind" } |
| 98 |
!$omp allocate (rr) allocator(3_2) ! { dg-error "Expected integer expression of the 'omp_allocator_handle_kind' kind" } |
| 99 |
!$omp allocate (ss) allocator([omp_pteam_mem_alloc]) ! { dg-error "Expected integer expression of the 'omp_allocator_handle_kind' kind" } |
| 100 |
!$omp allocate (tt) allocator(my_alloc) ! OK |
| 101 |
end |
| 102 |
|
| 103 |
|
| 104 |
subroutine five_SaveAll(n,my_alloc) |
| 105 |
use my_omp_lib |
| 106 |
implicit none |
| 107 |
save |
| 108 |
integer :: qq, rr, ss, tt, uu, vv,n |
| 109 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 110 |
!$omp allocate (qq) allocator(3.0) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'qq' at .2. has the SAVE attribute" } |
| 111 |
!$omp allocate (rr) allocator(3_2) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'rr' at .2. has the SAVE attribute" } |
| 112 |
!$omp allocate (ss) allocator([omp_pteam_mem_alloc]) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'ss' at .2. has the SAVE attribute" } |
| 113 |
!$omp allocate (tt) allocator(my_alloc) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'tt' at .2. has the SAVE attribute" } |
| 114 |
end |
| 115 |
|
| 116 |
|
| 117 |
subroutine five_Save(n,my_alloc) |
| 118 |
use my_omp_lib |
| 119 |
implicit none |
| 120 |
integer :: n |
| 121 |
integer, save :: qq, rr, ss, tt, uu, vv |
| 122 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 123 |
!$omp allocate (qq) allocator(3.0) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'qq' at .2. has the SAVE attribute" } |
| 124 |
!$omp allocate (rr) allocator(3_2) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'rr' at .2. has the SAVE attribute" } |
| 125 |
!$omp allocate (ss) allocator([omp_pteam_mem_alloc]) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'ss' at .2. has the SAVE attribute" } |
| 126 |
!$omp allocate (tt) allocator(my_alloc) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'tt' at .2. has the SAVE attribute" } |
| 127 |
end |
| 128 |
|
| 129 |
module five_Module |
| 130 |
use my_omp_lib |
| 131 |
implicit none |
| 132 |
integer, save :: qq, rr, ss, tt, uu, vv,n |
| 133 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 134 |
!$omp allocate (qq) allocator(3.0) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'qq' at .2. has the SAVE attribute" } |
| 135 |
!$omp allocate (rr) allocator(3_2) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'rr' at .2. has the SAVE attribute" } |
| 136 |
!$omp allocate (ss) allocator([omp_pteam_mem_alloc]) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'ss' at .2. has the SAVE attribute" } |
| 137 |
!$omp allocate (tt) allocator(my_alloc) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'tt' at .2. has the SAVE attribute" } |
| 138 |
end module |
| 139 |
|
| 140 |
program five_program |
| 141 |
use my_omp_lib |
| 142 |
implicit none |
| 143 |
integer, save :: qq, rr, ss, tt, uu, vv,n |
| 144 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 145 |
!$omp allocate (qq) allocator(3.0) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'qq' at .2. has the SAVE attribute" } |
| 146 |
!$omp allocate (rr) allocator(3_2) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'rr' at .2. has the SAVE attribute" } |
| 147 |
!$omp allocate (ss) allocator([omp_pteam_mem_alloc]) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'ss' at .2. has the SAVE attribute" } |
| 148 |
!$omp allocate (tt) allocator(my_alloc) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item 'tt' at .2. has the SAVE attribute" } |
| 149 |
end program |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
subroutine six(n,my_alloc) |
| 154 |
use my_omp_lib |
| 155 |
implicit none |
| 156 |
integer :: qq, rr, ss, tt, uu, vv,n |
| 157 |
common /com6qq/ qq |
| 158 |
common /com6rr/ rr |
| 159 |
common /com6ss/ ss |
| 160 |
common /com6tt/ tt |
| 161 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 162 |
|
| 163 |
!$omp allocate (/com6qq/) allocator(3.0) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item '/com6qq/' at .2. has the SAVE attribute" } |
| 164 |
!$omp allocate (/com6rr/) allocator(3_2) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item '/com6rr/' at .2. has the SAVE attribute" } |
| 165 |
!$omp allocate (/com6ss/) allocator([omp_pteam_mem_alloc]) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item '/com6ss/' at .2. has the SAVE attribute" } |
| 166 |
!$omp allocate (/com6tt/) allocator(my_alloc) ! { dg-error "Predefined allocator required in ALLOCATOR clause at .1. as the list item '/com6tt/' at .2. has the SAVE attribute" } |
| 167 |
end |
| 168 |
|
| 169 |
|
| 170 |
subroutine two() |
| 171 |
use my_omp_lib |
| 172 |
implicit none |
| 173 |
integer,allocatable :: qq, rr, ss, tt, uu, vv,n |
| 174 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 175 |
|
| 176 |
call foo() |
| 177 |
!$omp allocate (qq) allocator(3.0) ! { dg-error "Expected integer expression of the 'omp_allocator_handle_kind' kind" } |
| 178 |
allocate(qq) |
| 179 |
!$omp allocate (rr) allocator(3_2) ! { dg-error "Expected integer expression of the 'omp_allocator_handle_kind' kind" } |
| 180 |
allocate(rr) |
| 181 |
!$omp allocate (ss) allocator([omp_pteam_mem_alloc]) ! { dg-error "Expected integer expression of the 'omp_allocator_handle_kind' kind" } |
| 182 |
allocate(ss) |
| 183 |
!$omp allocate (tt) allocator(my_alloc) ! OK |
| 184 |
allocate(tt) |
| 185 |
end |
| 186 |
|
| 187 |
subroutine two_ptr() |
| 188 |
use my_omp_lib |
| 189 |
implicit none |
| 190 |
integer,pointer :: qq, rr, ss, tt, uu, vv,n |
| 191 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 192 |
|
| 193 |
call foo() |
| 194 |
!$omp allocate (qq) align(3+n) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 195 |
allocate(qq) |
| 196 |
!$omp allocate (rr) align([4]) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 197 |
allocate(rr) |
| 198 |
!$omp allocate (ss) align([4]) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 199 |
allocate(ss) |
| 200 |
!$omp allocate (tt) align(32.0) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 201 |
allocate(tt) |
| 202 |
!$omp allocate (uu) align(31) ! { dg-error "ALIGN requires a scalar positive constant integer alignment expression at .1. that is a power of two" } |
| 203 |
allocate(uu) |
| 204 |
end |
| 205 |
|
| 206 |
subroutine next() |
| 207 |
use my_omp_lib |
| 208 |
implicit none |
| 209 |
integer,allocatable :: qq, rr, ss, tt, uu, vv,n |
| 210 |
integer(omp_allocator_handle_kind) :: my_alloc |
| 211 |
|
| 212 |
!$omp allocate(qq) ! { 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" } |
| 213 |
allocate(qq,rr) |
| 214 |
|
| 215 |
!$omp allocate(uu,tt) |
| 216 |
!$omp allocate(tt) ! { dg-warning "'tt' appears more than once in 'allocate" } |
| 217 |
allocate(uu,tt) |
| 218 |
|
| 219 |
!$omp allocate(uu,vv) ! { dg-error "'uu' specified in 'allocate' at .1. but not in the associated ALLOCATE statement" } |
| 220 |
allocate(vv) |
| 221 |
end |