1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Atomic construct
! section 2.17.7
! Intrinsic procedure name is one of MAX, MIN, IAND, IOR, or IEOR.
program OmpAtomic
use omp_lib
real x
integer :: y, z, a, b, c, d
x = 5.73
y = 3
z = 1
!$omp atomic
y = IAND(y, 4)
!$omp atomic
y = IOR(y, 5)
!$omp atomic
y = IEOR(y, 6)
!$omp atomic
y = MAX(y, 7)
!$omp atomic
y = MIN(y, 8)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IAND(y, 4)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IOR(y, 5)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IEOR(y, 6)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = MAX(y, 7, b, c)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = MIN(y, 8, a, d)
!$omp atomic
!ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'y'
y = FRACTION(x)
!$omp atomic
!ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'y'
y = REAL(x)
!$omp atomic update
y = IAND(y, 4)
!$omp atomic update
y = IOR(y, 5)
!$omp atomic update
y = IEOR(y, 6)
!$omp atomic update
y = MAX(y, 7)
!$omp atomic update
y = MIN(y, 8)
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IAND(y, 4)
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IOR(y, 5)
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IEOR(y, 6)
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = MAX(y, 7)
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = MIN(y, 8)
!$omp atomic update
!ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
y = MOD(y, 9)
!$omp atomic update
!ERROR: Invalid intrinsic procedure name in OpenMP ATOMIC (UPDATE) statement
x = ABS(x)
end program OmpAtomic
subroutine conflicting_types()
type simple
integer :: z
end type
real x
integer :: y, z
type(simple) ::s
z = 1
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'z'
z = IAND(s%z, 4)
end subroutine
subroutine more_invalid_atomic_update_stmts()
integer :: a, b
integer :: k(10)
type some_type
integer :: m(10)
end type
type(some_type) :: s
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'a'
a = min(a, a, b)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'a'
a = max(b, a, b, a)
!$omp atomic
!ERROR: Atomic update statement should be of the form `a = intrinsic_procedure(a, expr_list)` OR `a = intrinsic_procedure(expr_list, a)`
a = min(b, a, b)
!$omp atomic
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'a'
a = max(b, a, b, a, b)
!$omp atomic update
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'y'
y = min(z, x)
!$omp atomic
z = max(z, y)
!$omp atomic update
!ERROR: Expected scalar variable on the LHS of atomic update assignment statement
!ERROR: Intrinsic procedure arguments in atomic update statement must have exactly one occurence of 'k'
k = max(x, y)
!$omp atomic
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)
!ERROR: Expected scalar expression on the RHS of atomic update assignment statement
x = min(x, k)
!$omp atomic
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)
!ERROR: Expected scalar expression on the RHS of atomic update assignment statement
z =z + s%m
end subroutine
|