1 // { dg-do run } 2 3 extern "C" void abort (void); 4 long long l, m; 5 int i, j; 6 7 void foo(void)8foo (void) 9 { 10 #pragma omp atomic read 11 i = l; 12 #pragma omp atomic read 13 m = j; 14 if (i != 77 || m != 88) 15 abort (); 16 #pragma omp atomic write 17 l = 1 + i + 6 * 1; 18 #pragma omp atomic write 19 j = 170 - 170 + m + 1 * 7; 20 #pragma omp atomic capture 21 i = l += 4; 22 #pragma omp atomic capture 23 m = j += 4; 24 if (i != 88 || m != 99) 25 abort (); 26 #pragma omp atomic capture 27 { 28 i = l; 29 l += 4; 30 } 31 #pragma omp atomic capture 32 { 33 m = j; 34 j += 4; 35 } 36 if (i != 88 || m != 99) 37 abort (); 38 #pragma omp atomic capture 39 { 40 l += 4; 41 i = l; 42 } 43 #pragma omp atomic capture 44 { 45 j += 4; 46 m = j; 47 } 48 if (i != 96 || m != 107) 49 abort (); 50 } 51 52 int main()53main () 54 { 55 l = 77; 56 j = 88; 57 foo (); 58 } 59