Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/allocate-18.c

raw
1 typedef enum omp_allocator_handle_t
2 #if __cplusplus >= 201103L
3 : __UINTPTR_TYPE__
4 #endif
5 {
6 omp_null_allocator = 0,
7 omp_default_mem_alloc = 1,
8 omp_large_cap_mem_alloc = 2,
9 omp_const_mem_alloc = 3,
10 omp_high_bw_mem_alloc = 4,
11 omp_low_lat_mem_alloc = 5,
12 omp_cgroup_mem_alloc = 6,
13 omp_pteam_mem_alloc = 7,
14 omp_thread_mem_alloc = 8,
15 __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
16 } omp_allocator_handle_t;
17
18 void test0 ()
19 {
20 int A1[5], B1[5];
21 #pragma omp allocate(A1) align(128) allocator(omp_default_mem_alloc)
22 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-1 } */
23
24 #ifndef __cplusplus
25 _Static_assert (_Alignof(A1) == _Alignof(B1), "wrong alignment");
26 #elif __cplusplus >= 201103L
27 static_assert (alignof(A1) == alignof(B1), "wrong alignment");
28 #endif
29 }
30
31 void
32 test1 ()
33 {
34 int x[5];
35 #pragma omp parallel allocate(omp_thread_mem_alloc: x) firstprivate(x)
36 x[0] = 1;
37
38 #pragma omp target allocate(omp_thread_mem_alloc: x) firstprivate(x) /* uses_allocators(omp_thread_mem_alloc) */
39 /* { dg-warning "allocator with access trait set to 'thread' results in undefined behavior for 'target' directive \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */
40 x[0] = 1;
41
42 #pragma omp taskloop allocate(omp_thread_mem_alloc: x) firstprivate(x)
43 /* { dg-warning "allocator with access trait set to 'thread' results in undefined behavior for 'taskloop' directive \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */
44 for (int i = 0; i < 5; i++)
45 x[i] = i;
46
47 #pragma 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 for (int i = 0; i < 5; i++)
50 x[i] = i;
51
52 #pragma omp parallel
53 #pragma omp masked
54 {
55 #pragma 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[0] = 1;
58 }
59 }