1 #include <omp.h> 2 3 /* Orphaned work sharing. */ 4 5 extern void abort (void); 6 7 #define N 10 8 parloop(int * a)9void parloop (int *a) 10 { 11 int i; 12 13 #pragma omp for 14 for (i = 0; i < N; i++) 15 a[i] = i + 3; 16 } 17 18 int main()19main() 20 { 21 int i, a[N]; 22 23 #pragma omp parallel shared(a) 24 { 25 parloop (a); 26 } 27 28 for (i = 0; i < N; i++) 29 if (a[i] != i + 3) 30 abort (); 31 32 return 0; 33 } 34