1 // { dg-do run } 2 3 extern void abort (void); 4 int x = 6; 5 6 int main()7main () 8 { 9 int v, l = 2, s = 1; 10 #pragma omp atomic 11 x = -3 + x; 12 #pragma omp atomic read 13 v = x; 14 if (v != 3) 15 abort (); 16 #pragma omp atomic update 17 x = 3 * 2 * 1 + x; 18 #pragma omp atomic read 19 v = x; 20 if (v != 9) 21 abort (); 22 #pragma omp atomic capture 23 v = x = x | 16; 24 if (v != 25) 25 abort (); 26 #pragma omp atomic capture 27 v = x = x + 14 * 2 / 4; 28 if (v != 32) 29 abort (); 30 #pragma omp atomic capture 31 v = x = 5 | x; 32 if (v != 37) 33 abort (); 34 #pragma omp atomic capture 35 v = x = 40 + 12 - 2 - 7 - x; 36 if (v != 6) 37 abort (); 38 #pragma omp atomic read 39 v = x; 40 if (v != 6) 41 abort (); 42 #pragma omp atomic capture 43 { v = x; x = 3 + x; } 44 if (v != 6) 45 abort (); 46 #pragma omp atomic capture 47 { v = x; x = -1 * -1 * -1 * -1 - x; } 48 if (v != 9) 49 abort (); 50 #pragma omp atomic read 51 v = x; 52 if (v != -8) 53 abort (); 54 #pragma omp atomic capture 55 { x = 2 * 2 - x; v = x; } 56 if (v != 12) 57 abort (); 58 #pragma omp atomic capture 59 { x = 7 & x; v = x; } 60 if (v != 4) 61 abort (); 62 #pragma omp atomic capture 63 { v = x; x = 6; } 64 if (v != 4) 65 abort (); 66 #pragma omp atomic read 67 v = x; 68 if (v != 6) 69 abort (); 70 #pragma omp atomic capture 71 { v = x; x = 7 * 8 + 23; } 72 if (v != 6) 73 abort (); 74 #pragma omp atomic read 75 v = x; 76 if (v != 79) 77 abort (); 78 #pragma omp atomic capture 79 { v = x; x = 23 + 6 * 4; } 80 if (v != 79) 81 abort (); 82 #pragma omp atomic read 83 v = x; 84 if (v != 47) 85 abort (); 86 #pragma omp atomic capture 87 { v = x; x = l ? 17 : 12; } 88 if (v != 47) 89 abort (); 90 #pragma omp atomic capture 91 { v = x; x = l = s++ + 3; } 92 if (v != 17 || l != 4 || s != 2) 93 abort (); 94 #pragma omp atomic read 95 v = x; 96 if (v != 4) 97 abort (); 98 return 0; 99 } 100