Harden SLP reduction support wrt STMT_VINFO_REDUC_IDX
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / target-device-ancestor-2.c
blobb16e701bd5a175b5d647143e15fe35b9a32ad89b
1 /* { dg-do compile } */
3 #pragma omp requires reverse_offload
5 void
6 foo (int n)
8 #pragma omp target device (ancestor: 1)
12 /* Ensure that the integer expression in the 'device' clause for
13 device-modifier 'ancestor' evaluates to '1' in case of a constant. */
15 #pragma omp target device (ancestor : 1)
17 #pragma omp target device (ancestor : 42) /* { dg-error "the 'device' clause expression must evaluate to '1'" } */
20 #pragma omp target device (ancestor : n)
22 #pragma omp target device (ancestor : n + 1)
26 /* Ensure that only one 'device' clause appears on the construct. */
28 #pragma omp target device (17) device (42) /* { dg-error "too many 'device' clauses" } */
32 /* Ensure that with 'ancestor' only the 'device', 'firstprivate', 'private',
33 'defaultmap', and 'map' clauses appear on the construct. */
35 #pragma omp target nowait device (ancestor: 1) /* { dg-error "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" } */
37 #pragma omp target device (ancestor: 1) nowait /* { dg-error "with 'ancestor', only the 'device', 'firstprivate', 'private', 'defaultmap', and 'map' clauses may appear on the construct" } */
39 #pragma omp target nowait device (42)
41 #pragma omp target nowait device (device_num: 42)
44 int a = 0, b = 0, c = 0;
45 #pragma omp target device (ancestor: 1) firstprivate (a) private (b) defaultmap (none) map (c)
49 /* Ensure that 'ancestor' is only used with 'target' constructs (not with
50 'target data', 'target update' etc.). */
52 #pragma omp target data map (a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" } */
54 #pragma omp target enter data map (to: a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" } */
55 #pragma omp target exit data map (from: a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" } */
56 #pragma omp target update to (a) device (ancestor: 1) /* { dg-error "'device' clause with 'ancestor' is only allowed on 'target' construct" "" { target *-*-* } } */
59 /* Ensure that no OpenMP constructs appear inside target regions with
60 'ancestor'. */
62 #pragma omp target device (ancestor: 1)
64 #pragma omp teams /* { dg-error "OpenMP constructs are not allowed in target region with 'ancestor'" } */
68 #pragma omp target device (device_num: 1)
70 #pragma omp teams
74 #pragma omp target device (1)
76 #pragma omp teams