Debian Codegraph @

libgomp/testsuite/libgomp.fortran/allocate-static.f90

raw
1 module m
2 use iso_c_binding, only: c_intptr_t
3 use omp_lib_kinds, only: omp_default_mem_alloc
4 implicit none (type, external)
5
6 integer(c_intptr_t) :: intptr
7
8 integer :: A(4) = [1,2,3,4]
9 !$omp allocate(A) align(128) allocator(omp_default_mem_alloc)
10 contains
11 subroutine f()
12 integer :: B(4) = [1,2,3,4]
13 !$omp allocate(B) align(256) allocator(omp_default_mem_alloc)
14
15 if (mod (transfer (loc (A), intptr), 128_c_intptr_t) /= 0) stop 1
16 if (mod (transfer (loc (B), intptr), 256_c_intptr_t) /= 0) stop 2
17
18 call inner()
19 contains
20 subroutine inner()
21 integer :: C(4) = [1,2,3,4]
22 !$omp allocate(C) align(1024) allocator(omp_default_mem_alloc)
23 if (mod (transfer (loc (A), intptr), 128_c_intptr_t) /= 0) stop 3
24 if (mod (transfer (loc (B), intptr), 256_c_intptr_t) /= 0) stop 4
25 if (mod (transfer (loc (C), intptr), 1024_c_intptr_t) /= 0) stop 5
26 end
27 end
28 end
29
30 use m
31 implicit none (type, external)
32 if (mod (transfer (loc (A), intptr), 128_c_intptr_t) /= 0) stop 6
33 call f()
34 end