Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/allocate-clause.f90

raw
1 module omp_lib_kinds
2 use iso_c_binding, only: c_int, c_intptr_t
3 implicit none
4 private :: c_int, c_intptr_t
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 integer (kind=omp_allocator_handle_kind), &
10 parameter :: omp_default_mem_alloc = 1
11 integer (kind=omp_allocator_handle_kind), &
12 parameter :: omp_large_cap_mem_alloc = 2
13 integer (kind=omp_allocator_handle_kind), &
14 parameter :: omp_const_mem_alloc = 3
15 integer (kind=omp_allocator_handle_kind), &
16 parameter :: omp_high_bw_mem_alloc = 4
17 integer (kind=omp_allocator_handle_kind), &
18 parameter :: omp_low_lat_mem_alloc = 5
19 integer (kind=omp_allocator_handle_kind), &
20 parameter :: omp_cgroup_mem_alloc = 6
21 integer (kind=omp_allocator_handle_kind), &
22 parameter :: omp_pteam_mem_alloc = 7
23 integer (kind=omp_allocator_handle_kind), &
24 parameter :: omp_thread_mem_alloc = 8
25 end module
26
27 subroutine test1 ()
28 use omp_lib_kinds
29 implicit none
30 integer :: x(5), i
31
32 !$omp parallel allocate(omp_thread_mem_alloc: x) firstprivate(x)
33 x(1) = 1
34 !$omp end parallel
35
36 !$omp target allocate(omp_thread_mem_alloc: x) firstprivate(x) ! uses_allocators(omp_thread_mem_alloc)
37 ! { dg-warning "allocator with access trait set to 'thread' results in undefined behavior for 'target' directive \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 }
38 x(1) = 1
39 !$omp end target
40
41 !$omp taskloop allocate(omp_thread_mem_alloc: x) firstprivate(x)
42 ! { dg-warning "allocator with access trait set to 'thread' results in undefined behavior for 'taskloop' directive \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 }
43 do i = 1, 5
44 x(i) = i
45 end do
46
47 !$omp parallel master taskloop simd allocate(omp_thread_mem_alloc: x) firstprivate(x)
48 ! { dg-warning "allocator with access trait set to 'thread' results in undefined behavior for 'taskloop' directive \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 }
49 do i = 1, 5
50 x(i) = i
51 end do
52
53 !$omp parallel
54 !$omp masked
55 !$omp task allocate(omp_thread_mem_alloc: x) firstprivate(x)
56 ! { dg-warning "allocator with access trait set to 'thread' results in undefined behavior for 'task' directive \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 }
57 x(1) = 1
58 !$omp end task
59 !$omp end masked
60 !$omp end parallel
61 end