Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/allocate-19.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 ompx_gnu_pinned_bogus_1 = 9,
16 ompx_gnu_pinned_bogus_2 = 199,
17 ompx_gnu_pinned_mem_alloc = 200,
18 ompx_gnu_pinned_bogus_3 = 2001,
19 __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
20 } omp_allocator_handle_t;
21
22 static int A1[5] = {1,2,3,4,5}, B1[5];
23 #pragma omp allocate(A1) align(128) allocator(omp_default_mem_alloc)
24 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-1 } */
25
26 #ifndef __cplusplus
27 _Static_assert (_Alignof(A1) == _Alignof(B1), "wrong alignment");
28 #elif __cplusplus >= 201103L
29 static_assert (alignof(A1) == alignof(B1), "wrong alignment");
30 #endif
31
32
33 static int *ptr;
34 #pragma omp allocate(ptr) align(2) allocator(omp_default_mem_alloc)
35 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-1 } */
36
37 #ifndef __cplusplus
38 _Static_assert (_Alignof(ptr) == _Alignof(int*), "wrong alignment");
39 #elif __cplusplus >= 201103L
40 static_assert (alignof(ptr) == alignof(int*), "wrong alignment");
41 #endif
42
43
44 int *
45 get ()
46 {
47 static int q = 0;
48 #pragma omp allocate(q) align(1024) allocator(omp_default_mem_alloc)
49 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-1 } */
50
51 #ifndef __cplusplus
52 _Static_assert (_Alignof(q) == _Alignof(int), "wrong alignment");
53 #elif __cplusplus >= 201103L
54 static_assert (alignof(q) == alignof(int), "wrong alignment");
55 #endif
56
57 q += 1;
58 return &A1[q];
59 }
60
61 static int invalid1, okay1, invalid2, invalid3;
62 #pragma omp allocate(invalid1) align(128) allocator(ompx_gnu_pinned_bogus_1) /* { dg-error "'allocator' clause requires a predefined allocator as 'invalid1' is static" "" { xfail c++ } } */
63 #pragma omp allocate(okay1) align(128) allocator(ompx_gnu_pinned_mem_alloc) /* Okay */
64 #pragma omp allocate(invalid2) align(128) allocator(ompx_gnu_pinned_bogus_2) /* { dg-error "'allocator' clause requires a predefined allocator as 'invalid2' is static" "" { xfail c++ } } */
65 #pragma omp allocate(invalid3) align(128) allocator(ompx_gnu_pinned_bogus_3) /* { dg-error "'allocator' clause requires a predefined allocator as 'invalid3' is static" "" { xfail c++ } } */
66 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-4 } */
67 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-4 } */
68 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-4 } */
69 /* { dg-message "sorry, unimplemented: '#pragma omp allocate' not yet supported" "" { target c++ } .-4 } */