1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2
3! OpenMP Atomic construct
4! section 2.17.7
5! Intrinsic procedure name is one of MAX, MIN, IAND, IOR, or IEOR.
6
7program OmpAtomic
8   use omp_lib
9   real x
10   integer :: y, z, a, b, c, d
11   x = 5.73
12   y = 3
13   z = 1
14!$omp atomic
15   y = IAND(y, 4)
16!$omp atomic
17   y = IOR(y, 5)
18!$omp atomic
19   y = IEOR(y, 6)
20!$omp atomic
21   y = MAX(y, 7)
22!$omp atomic
23   y = MIN(y, 8)
24
25!$omp atomic
26   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
27   z = IAND(y, 4)
28!$omp atomic
29   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
30   z = IOR(y, 5)
31!$omp atomic
32   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
33   z = IEOR(y, 6)
34!$omp atomic
35   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
36   z = MAX(y, 7, b, c)
37!$omp atomic
38   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
39   z = MIN(y, 8, a, d)
40
41!$omp atomic
42   !ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
43   y = FRACTION(x)
44!$omp atomic
45   !ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
46   y = REAL(x)
47!$omp atomic update
48   y = IAND(y, 4)
49!$omp atomic update
50   y = IOR(y, 5)
51!$omp atomic update
52   y = IEOR(y, 6)
53!$omp atomic update
54   y = MAX(y, 7)
55!$omp atomic update
56   y = MIN(y, 8)
57
58!$omp atomic update
59   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
60   z = IAND(y, 4)
61!$omp atomic update
62   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
63   z = IOR(y, 5)
64!$omp atomic update
65   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
66   z = IEOR(y, 6)
67!$omp atomic update
68   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
69   z = MAX(y, 7)
70!$omp atomic update
71   !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
72   z = MIN(y, 8)
73
74!$omp atomic update
75   !ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
76   y = MOD(y, 9)
77!$omp atomic update
78   !ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
79   x = ABS(x)
80end program OmpAtomic
81
82subroutine conflicting_types()
83    type simple
84    integer :: z
85    end type
86    real x
87    integer :: y, z
88    type(simple) ::s
89    z = 1
90    !$omp atomic
91    !ERROR: Atomic update variable 'z' not found in the argument list of intrinsic procedure
92    z = IAND(s%z, 4)
93end subroutine
94