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