Debian Codegraph @

gcc/testsuite/g++.dg/gomp/attrs-7.C

raw
1 // { dg-do compile { target c++11 } }
2
3 void
4 foo ()
5 {
6
7 [[omp::directive (parallel sections)]]
8 {
9 [[omp::directive (parallel)]];
10 [[omp::sequence (directive (section), directive (flush))]]; // { dg-error "must be the only specified attribute on a statement" }
11 // { dg-error "#pragma omp section" "" { target *-*-* } .-1 }
12 // { dg-error "#pragma omp flush" "" { target *-*-* } .-2 }
13 [[omp::sequence (directive (flush), omp::directive (section))]]; // { dg-error "must be the only specified attribute on a statement" }
14 // { dg-error "#pragma omp flush" "" { target *-*-* } .-1 }
15 [[gnu::cold, omp::directive (section)]]; // { dg-error "must be the only specified attribute on a statement" }
16 // { dg-error "#pragma omp section" "" { target *-*-* } .-1 }
17 [[omp::directive (section)]] [[gnu::cold]]; // { dg-error "must be the only specified attribute on a statement" }
18 // { dg-error "#pragma omp section" "" { target *-*-* } .-1 }
19 [[omp::directive (section foo)]]; // { dg-error "expected end of line before 'foo'" }
20 }
21 }
22
23 int
24 bar (int a, int *c, int *d, int *e, int *f)
25 {
26 int i;
27 [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
28 for (i = 0; i < 64; i++)
29 {
30 d[i] = a;
31 [[omp::sequence (omp::directive (parallel), omp::directive (scan, exclusive (a)))]] // { dg-error "must be the only specified attribute on a statement" }
32 // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
33 a += c[i]; // { dg-error "expected" }
34 }
35 [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
36 for (i = 0; i < 64; i++)
37 {
38 a += c[i];
39 [[omp::sequence (directive (scan inclusive (a)), directive (critical))]] // { dg-error "must be the only specified attribute on a statement" }
40 // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
41 d[i] = a; // { dg-error "expected" }
42 }
43 [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
44 for (i = 0; i < 64; i++)
45 {
46 d[i] = a;
47 [[gnu::cold]] [[omp::directive (scan, exclusive (a))]] // { dg-error "must be the only specified attribute on a statement" }
48 // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
49 a += c[i]; // { dg-error "expected" }
50 }
51 [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
52 for (i = 0; i < 64; i++)
53 {
54 d[i] = a;
55 [[omp::directive (scan, exclusive (a)), gnu::cold]] // { dg-error "must be the only specified attribute on a statement" }
56 // { dg-error "#pragma omp scan" "" { target *-*-* } .-1 }
57 a += c[i]; // { dg-error "expected" }
58 }
59 [[omp::directive (parallel for reduction (inscan, +: a))]] // { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
60 for (i = 0; i < 64; i++)
61 {
62 d[i] = a;
63 [[omp::directive (scan)]] // { dg-error "expected 'inclusive' or 'exclusive' clause before end of line" }
64 a += c[i];
65 }
66 return a;
67 }