| 1 |
/* { dg-do compile { target { c || c++11 } } } */ |
| 2 |
/* { dg-additional-options "-std=c23" { target c } } */ |
| 3 |
/* { dg-prune-output "error: invalid controlling predicate" } */ |
| 4 |
|
| 5 |
extern void dummy (int); |
| 6 |
|
| 7 |
void |
| 8 |
test (void) |
| 9 |
{ |
| 10 |
[[omp::sequence (directive (unroll partial), |
| 11 |
directive (unroll full))]] /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" } */ |
| 12 |
for (int i = -300; i != 100; ++i) |
| 13 |
dummy (i); |
| 14 |
|
| 15 |
[[omp::sequence (directive (for), |
| 16 |
directive (unroll full), /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" } */ |
| 17 |
directive (unroll partial))]] |
| 18 |
for (int i = -300; i != 100; ++i) |
| 19 |
dummy (i); |
| 20 |
|
| 21 |
[[omp::sequence (directive (for), |
| 22 |
directive (unroll full), |
| 23 |
directive (unroll full))]] /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" } */ |
| 24 |
for (int i = -300; i != 100; ++i) |
| 25 |
dummy (i); |
| 26 |
|
| 27 |
[[omp::sequence (directive (for), |
| 28 |
directive (unroll partial partial))]] /* { dg-error "too many 'partial' clauses" } */ |
| 29 |
for (int i = -300; i != 100; ++i) |
| 30 |
dummy (i); |
| 31 |
|
| 32 |
[[omp::directive (unroll full full)]] /* { dg-error "too many 'full' clauses" } */ |
| 33 |
for (int i = -300; i != 100; ++i) |
| 34 |
dummy (i); |
| 35 |
|
| 36 |
[[omp::sequence (directive (unroll partial), |
| 37 |
directive (unroll))]] /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" } */ |
| 38 |
for (int i = -300; i != 100; ++i) |
| 39 |
dummy (i); |
| 40 |
|
| 41 |
[[omp::sequence (directive (for), |
| 42 |
directive (unroll))]] /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" } */ |
| 43 |
for (int i = -300; i != 100; ++i) |
| 44 |
dummy (i); |
| 45 |
|
| 46 |
int i; |
| 47 |
|
| 48 |
[[omp::sequence (directive (for), /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" "" { target *-*-* } .+1 } */ |
| 49 |
directive (unroll foo))]] /* { dg-error "expected an OpenMP clause before 'foo'" } */ |
| 50 |
for (int i = -300; i != 100; ++i) |
| 51 |
dummy (i); |
| 52 |
|
| 53 |
[[omp::directive (unroll partial(i))]] |
| 54 |
/* { dg-error "the value of 'i' is not usable in a constant expression" "" { target c++ } .-1 } */ |
| 55 |
/* { dg-error "'partial' argument needs positive constant integer expression" "" { target *-*-* } .-2 } */ |
| 56 |
for (int i = -300; i != 100; ++i) |
| 57 |
dummy (i); |
| 58 |
|
| 59 |
[[omp::directive (unroll parti)]] /* { dg-error "expected an OpenMP clause before 'parti'" } */ |
| 60 |
for (int i = -300; i != 100; ++i) |
| 61 |
dummy (i); |
| 62 |
|
| 63 |
[[omp::sequence (directive (for), |
| 64 |
directive (unroll partial(1)), /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" "" { target *-*-* } .+1 } */ |
| 65 |
directive (unroll parti))]] /* { dg-error "expected an OpenMP clause before 'parti'" } */ |
| 66 |
for (int i = -300; i != 100; ++i) |
| 67 |
dummy (i); |
| 68 |
|
| 69 |
[[omp::sequence (directive (for), |
| 70 |
directive (unroll partial(1)), /* { dg-error "generated loop of 'unroll' construct without 'partial' clause does not have canonical form" "" { target *-*-* } .+1 } */ |
| 71 |
directive (unroll parti))]] /* { dg-error "expected an OpenMP clause before 'parti'" } */ |
| 72 |
for (int i = -300; i != 100; ++i) |
| 73 |
dummy (i); |
| 74 |
|
| 75 |
int sum = 0; |
| 76 |
[[omp::sequence (directive (parallel for reduction(+ : sum) collapse(2)), |
| 77 |
directive (unroll partial(1)))]] /* { dg-error "'unroll' construct with 'partial' clause generates just one loop with canonical form but 2 loops are needed" } */ |
| 78 |
for (int i = 3; i < 10; ++i) |
| 79 |
for (int j = -2; j < 7; ++j) |
| 80 |
sum++; |
| 81 |
} |