Debian Codegraph @

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

raw
1 /* TODO: enable for C++ once implemented. */
2 /* { dg-do compile { target c } } */
3
4 typedef enum omp_allocator_handle_t
5 #if __cplusplus >= 201103L
6 : __UINTPTR_TYPE__
7 #endif
8 {
9 omp_default_mem_alloc = 1,
10 omp_low_lat_mem_alloc = 5,
11 __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
12 } omp_allocator_handle_t;
13
14 omp_allocator_handle_t foo(int, int *);
15
16
17 void
18 f ()
19 {
20 int v; /* { dg-note "to be allocated variable declared here" } */
21 int n = 5;
22 int a = 1; /* { dg-note "declared here" } */
23 int b[n];
24 b[a] = 5;
25 #pragma omp allocate (v) allocator (foo (a, &b[a])) /* { dg-error "variable 'a' used in the 'allocator' clause must be declared before 'v'" } */
26 }
27
28 void
29 g ()
30 {
31 int n = 5;
32 int a = 1;
33 int b[n];
34 b[a] = 5;
35 int v; /* { dg-note "to be allocated variable declared here" } */
36 a = 2; /* { dg-note "modified here" } */
37 #pragma omp allocate (v) allocator (foo (a, &b[a])) /* { dg-error "variable 'a' used in the 'allocator' clause must not be modified between declaration of 'v' and its 'allocate' directive" } */
38 }