00001 extern void abort (void); 00002 00003 int a = 18; 00004 00005 void 00006 f1 (int i, int j, int k) 00007 { 00008 int l = 6, m = 7, n = 8; 00009 #pragma omp parallel private(j, m) shared(k, n) firstprivate(i, l) \ 00010 num_threads(1) 00011 { 00012 j = 6; 00013 m = 5; 00014 if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9) 00015 #pragma omp atomic 00016 k++; 00017 } 00018 if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9) 00019 abort (); 00020 } 00021 00022 int v1 = 1, v2 = 2, v5 = 5; 00023 int err; 00024 00025 void 00026 f2 (void) 00027 { 00028 int v3 = 3; 00029 #pragma omp sections private (v1) firstprivate (v2) 00030 { 00031 #pragma omp section 00032 { 00033 int v4 = 4; 00034 v1 = 7; 00035 #pragma omp parallel num_threads(1) firstprivate(v1, v2, v3, v4) 00036 { 00037 if (++v1 != 8 || ++v2 != 3 || ++v3 != 4 || ++v4 != 5 || ++v5 != 6) 00038 err = 1; 00039 } 00040 if (v1 != 7 || v2 != 2 || v3 != 3 || v4 != 4 || v5 != 6) 00041 abort (); 00042 if (err) 00043 abort (); 00044 } 00045 } 00046 } 00047 00048 int 00049 main (void) 00050 { 00051 f1 (8, 26, 0); 00052 f2 (); 00053 return 0; 00054 }