1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2
3! OpenMP Atomic construct
4! section 2.17.7
5! Update assignment must be 'var = var op expr' or 'var = expr op var'
6
7program OmpAtomic
8   use omp_lib
9   real x
10   integer y
11   logical m, n, l
12   x = 5.73
13   y = 3
14   m = .TRUE.
15   n = .FALSE.
16!$omp atomic
17   x = x + 1
18!$omp atomic
19   x = 1 + x
20!$omp atomic
21   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
22   x = y + 1
23!$omp atomic
24   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
25   x = 1 + y
26
27!$omp atomic
28   x = x - 1
29!$omp atomic
30   x = 1 - x
31!$omp atomic
32   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
33   x = y - 1
34!$omp atomic
35   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
36   x = 1 - y
37
38!$omp atomic
39   x = x*1
40!$omp atomic
41   x = 1*x
42!$omp atomic
43   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
44   x = y*1
45!$omp atomic
46   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
47   x = 1*y
48
49!$omp atomic
50   x = x/1
51!$omp atomic
52   x = 1/x
53!$omp atomic
54   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
55   x = y/1
56!$omp atomic
57   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
58   x = 1/y
59
60!$omp atomic
61   m = m .AND. n
62!$omp atomic
63   m = n .AND. m
64!$omp atomic
65   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
66   m = n .AND. l
67
68!$omp atomic
69   m = m .OR. n
70!$omp atomic
71   m = n .OR. m
72!$omp atomic
73   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
74   m = n .OR. l
75
76!$omp atomic
77   m = m .EQV. n
78!$omp atomic
79   m = n .EQV. m
80!$omp atomic
81   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
82   m = n .EQV. l
83
84!$omp atomic
85   m = m .NEQV. n
86!$omp atomic
87   m = n .NEQV. m
88!$omp atomic
89   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
90   m = n .NEQV. l
91
92!$omp atomic update
93   x = x + 1
94!$omp atomic update
95   x = 1 + x
96!$omp atomic update
97   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
98   x = y + 1
99!$omp atomic update
100   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
101   x = 1 + y
102
103!$omp atomic update
104   x = x - 1
105!$omp atomic update
106   x = 1 - x
107!$omp atomic update
108   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
109   x = y - 1
110!$omp atomic update
111   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
112   x = 1 - y
113
114!$omp atomic update
115   x = x*1
116!$omp atomic update
117   x = 1*x
118!$omp atomic update
119   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
120   x = y*1
121!$omp atomic update
122   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
123   x = 1*y
124
125!$omp atomic update
126   x = x/1
127!$omp atomic update
128   x = 1/x
129!$omp atomic update
130   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
131   x = y/1
132!$omp atomic update
133   !ERROR: Atomic update variable 'x' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
134   x = 1/y
135
136!$omp atomic update
137   m = m .AND. n
138!$omp atomic update
139   m = n .AND. m
140!$omp atomic update
141   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
142   m = n .AND. l
143
144!$omp atomic update
145   m = m .OR. n
146!$omp atomic update
147   m = n .OR. m
148!$omp atomic update
149   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
150   m = n .OR. l
151
152!$omp atomic update
153   m = m .EQV. n
154!$omp atomic update
155   m = n .EQV. m
156!$omp atomic update
157   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
158   m = n .EQV. l
159
160!$omp atomic update
161   m = m .NEQV. n
162!$omp atomic update
163   m = n .NEQV. m
164!$omp atomic update
165   !ERROR: Atomic update variable 'm' not found in the RHS of the assignment statement in an ATOMIC (UPDATE) construct
166   m = n .NEQV. l
167
168end program OmpAtomic
169