140 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags4 5! OpenMP Atomic construct6! section 2.17.77! Intrinsic procedure name is one of MAX, MIN, IAND, IOR, or IEOR.8 9program OmpAtomic10 use omp_lib11 real x12 integer :: y, z, a, b, c, d13 x = 5.7314 y = 315 z = 116!$omp atomic17 y = IAND(y, 4)18!$omp atomic19 y = IOR(y, 5)20!$omp atomic21 y = IEOR(y, 6)22!$omp atomic23 y = MAX(y, 7)24!$omp atomic25 y = MIN(y, 8)26 27!$omp atomic28 !ERROR: The atomic variable z should appear as an argument of the top-level AND operator29 z = IAND(y, 4)30!$omp atomic31 !ERROR: The atomic variable z should appear as an argument of the top-level OR operator32 z = IOR(y, 5)33!$omp atomic34 !ERROR: The atomic variable z should appear as an argument of the top-level NEQV/EOR operator35 z = IEOR(y, 6)36!$omp atomic37 !ERROR: The atomic variable z should appear as an argument of the top-level MAX operator38 z = MAX(y, 7, b, c)39!$omp atomic40 !ERROR: The atomic variable z should appear as an argument of the top-level MIN operator41 z = MIN(y, 8, a, d)42 43!$omp atomic44 !ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation45 y = FRACTION(x)46!$omp atomic47 !ERROR: The atomic variable y should appear as an argument in the update operation48 y = REAL(x)49!$omp atomic update50 y = IAND(y, 4)51!$omp atomic update52 y = IOR(y, 5)53!$omp atomic update54 y = IEOR(y, 6)55!$omp atomic update56 y = MAX(y, 7)57!$omp atomic update58 y = MIN(y, 8)59 60!$omp atomic update61 !ERROR: The atomic variable z should appear as an argument of the top-level AND operator62 z = IAND(y, 4)63!$omp atomic update 64 !ERROR: The atomic variable z should appear as an argument of the top-level OR operator65 z = IOR(y, 5)66!$omp atomic update67 !ERROR: The atomic variable z should appear as an argument of the top-level NEQV/EOR operator68 z = IEOR(y, 6)69!$omp atomic update70 !ERROR: The atomic variable z should appear as an argument of the top-level MAX operator71 z = MAX(y, 7)72!$omp atomic update73 !ERROR: The atomic variable z should appear as an argument of the top-level MIN operator74 z = MIN(y, 8)75 76!$omp atomic update77 !ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation78 y = MOD(y, 9)79!$omp atomic update80 !ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation81 x = ABS(x)82end program OmpAtomic83 84subroutine conflicting_types()85 type simple86 integer :: z87 end type88 real x89 integer :: y, z90 type(simple) ::s91 z = 192 !$omp atomic93 !ERROR: The atomic variable z should appear as an argument of the top-level AND operator94 z = IAND(s%z, 4)95end subroutine96 97subroutine more_invalid_atomic_update_stmts()98 integer :: a, b99 integer :: k(10)100 type some_type101 integer :: m(10)102 end type103 type(some_type) :: s104 105 !$omp atomic update106 !ERROR: The atomic variable a should be exactly one of the arguments of the top-level MIN operator107 a = min(a, a, b)108 109 !$omp atomic110 !ERROR: The atomic variable a should be exactly one of the arguments of the top-level MAX operator111 a = max(b, a, b, a)112 113 !$omp atomic114 a = min(b, a, b)115 116 !$omp atomic117 !ERROR: The atomic variable a should be exactly one of the arguments of the top-level MAX operator118 a = max(b, a, b, a, b)119 120 !$omp atomic update121 !ERROR: The atomic variable y should appear as an argument of the top-level MIN operator122 y = min(z, x)123 124 !$omp atomic125 z = max(z, y)126 127 !$omp atomic update128 !ERROR: Atomic variable k should be a scalar129 !ERROR: The atomic variable k should appear as an argument of the top-level MAX operator130 k = max(x, y)131 132 !$omp atomic133 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)134 x = min(x, k)135 136 !$omp atomic137 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)138 z = z + s%m139end subroutine140