2022-04-18 15:02:25 -07:00

36 lines
1008 B
C

/*
* @@name: default_none.1
* @@type: C
* @@compilable: no
* @@linkable: no
* @@expect: failure
*/
#include <omp.h>
int x, y, z[1000];
#pragma omp threadprivate(x)
void default_none(int a) {
const int c = 1;
int i = 0;
#pragma omp parallel default(none) private(a) shared(z, c)
{
int j = omp_get_num_threads();
/* O.K. - j is declared within parallel region */
a = z[j]; /* O.K. - a is listed in private clause */
/* - z is listed in shared clause */
x = c; /* O.K. - x is threadprivate */
/* - c has const-qualified type and
is listed in shared clause */
z[i] = y; /* Error - cannot reference i or y here */
#pragma omp for firstprivate(y)
/* Error - Cannot reference y in the firstprivate clause */
for (i=0; i<10 ; i++) {
z[i] = i; /* O.K. - i is the loop iteration variable */
}
z[i] = y; /* Error - cannot reference i or y here */
}
}