Debian Codegraph @

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

raw
1 /* TODO: enable for C++ once implemented. */
2 /* { dg-do compile { target c } } */
3 /* { dg-additional-options "-Wall -fdump-tree-gimple" } */
4
5 typedef enum omp_allocator_handle_t
6 #if __cplusplus >= 201103L
7 : __UINTPTR_TYPE__
8 #endif
9 {
10 omp_default_mem_alloc = 1,
11 __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
12 } omp_allocator_handle_t;
13
14 void
15 f()
16 {
17 int n;
18 int A[n]; /* { dg-warning "'n' is used uninitialized" } */
19 /* { dg-warning "unused variable 'A'" "" { target *-*-* } .-1 } */
20 }
21
22 void
23 h1()
24 {
25 omp_allocator_handle_t my_handle;
26 int B1[3]; /* { dg-warning "'my_handle' is used uninitialized" } */
27 /* { dg-warning "variable 'B1' set but not used" "" { target *-*-* } .-1 } */
28 #pragma omp allocate(B1) allocator(my_handle)
29 B1[0] = 5;
30 /* { dg-final { scan-tree-dump-times "__builtin_GOMP_alloc" 1 "gimple" } } */
31 /* { dg-final { scan-tree-dump-times "B1.\[0-9\]+ = __builtin_GOMP_alloc \\(4, 12, my_handle\\);" 1 "gimple" } } */
32 /* { dg-final { scan-tree-dump-times "__builtin_GOMP_free \\(B1.\[0-9\]+, 0B\\);" 1 "gimple" } } */
33 }
34
35 void
36 h2()
37 {
38 omp_allocator_handle_t my_handle;
39 int B2[3]; /* { dg-warning "unused variable 'B2'" } */
40 #pragma omp allocate(B2) allocator(my_handle) /* No warning as 'B2' is unused */
41 }
42
43 void
44 h3()
45 {
46 omp_allocator_handle_t my_handle;
47 int B3[3] = {1,2,3}; /* { dg-warning "unused variable 'B3'" } */
48 #pragma omp allocate(B3) allocator(my_handle) /* No warning as 'B3' is unused */
49 }