brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.4 KiB · 002e06b Raw
236 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags2 3! OpenMP Atomic construct4! section 2.17.75! Update assignment must be 'var = var op expr' or 'var = expr op var'6 7program OmpAtomic8   real x9   integer y10   logical m, n, l11   x = 5.7312   y = 313   m = .TRUE.14   n = .FALSE.15!$omp atomic16   x = x + 117!$omp atomic18   x = 1 + x19!$omp atomic20   !ERROR: The atomic variable x should appear as an argument of the top-level + operator21   x = y + 122!$omp atomic23   !ERROR: The atomic variable x should appear as an argument of the top-level + operator24   x = 1 + y25 26!$omp atomic27   x = x - 128!$omp atomic29   x = 1 - x30!$omp atomic31   !ERROR: The atomic variable x should appear as an argument of the top-level - operator32   x = y - 133!$omp atomic34   !ERROR: The atomic variable x should appear as an argument of the top-level - operator35   x = 1 - y36 37!$omp atomic38   x = x*139!$omp atomic40   x = 1*x41!$omp atomic42   !ERROR: The atomic variable x should appear as an argument in the update operation43   x = y*144!$omp atomic45   !ERROR: The atomic variable x should appear as an argument in the update operation46   x = 1*y47 48!$omp atomic49   x = x/150!$omp atomic51   x = 1/x52!$omp atomic53   !ERROR: The atomic variable x should appear as an argument of the top-level / operator54   x = y/155!$omp atomic56   !ERROR: The atomic variable x should appear as an argument of the top-level / operator57   x = 1/y58 59!$omp atomic60   m = m .AND. n61!$omp atomic62   m = n .AND. m63!$omp atomic 64   !ERROR: The atomic variable m should appear as an argument of the top-level AND operator65   m = n .AND. l66 67!$omp atomic68   m = m .OR. n69!$omp atomic70   m = n .OR. m71!$omp atomic 72   !ERROR: The atomic variable m should appear as an argument of the top-level OR operator73   m = n .OR. l74 75!$omp atomic76   m = m .EQV. n77!$omp atomic78   m = n .EQV. m79!$omp atomic80   !ERROR: The atomic variable m should appear as an argument of the top-level EQV operator81   m = n .EQV. l82 83!$omp atomic84   m = m .NEQV. n85!$omp atomic86   m = n .NEQV. m87!$omp atomic88   !ERROR: The atomic variable m should appear as an argument of the top-level NEQV/EOR operator89   m = n .NEQV. l90 91!$omp atomic update92   x = x + 193!$omp atomic update94   x = 1 + x95!$omp atomic update96   !ERROR: The atomic variable x should appear as an argument of the top-level + operator97   x = y + 198!$omp atomic update99   !ERROR: The atomic variable x should appear as an argument of the top-level + operator100   x = 1 + y101 102!$omp atomic update103   x = x - 1104!$omp atomic update105   x = 1 - x106!$omp atomic update107   !ERROR: The atomic variable x should appear as an argument of the top-level - operator108   x = y - 1109!$omp atomic update110   !ERROR: The atomic variable x should appear as an argument of the top-level - operator111   x = 1 - y112 113!$omp atomic update114   x = x*1115!$omp atomic update116   x = 1*x117!$omp atomic update118   !ERROR: The atomic variable x should appear as an argument in the update operation119   x = y*1120!$omp atomic update121   !ERROR: The atomic variable x should appear as an argument in the update operation122   x = 1*y123 124!$omp atomic update125   x = x/1126!$omp atomic update127   x = 1/x128!$omp atomic update129   !ERROR: The atomic variable x should appear as an argument of the top-level / operator130   x = y/1131!$omp atomic update132   !ERROR: The atomic variable x should appear as an argument of the top-level / operator133   x = 1/y134 135!$omp atomic update136   m = m .AND. n137!$omp atomic update138   m = n .AND. m139!$omp atomic update140   !ERROR: The atomic variable m should appear as an argument of the top-level AND operator141   m = n .AND. l142 143!$omp atomic update144   m = m .OR. n145!$omp atomic update146   m = n .OR. m147!$omp atomic update148   !ERROR: The atomic variable m should appear as an argument of the top-level OR operator149   m = n .OR. l150 151!$omp atomic update152   m = m .EQV. n153!$omp atomic update154   m = n .EQV. m155!$omp atomic update156   !ERROR: The atomic variable m should appear as an argument of the top-level EQV operator157   m = n .EQV. l158 159!$omp atomic update160   m = m .NEQV. n161!$omp atomic update162   m = n .NEQV. m163!$omp atomic update164   !ERROR: The atomic variable m should appear as an argument of the top-level NEQV/EOR operator165   m = n .NEQV. l166 167end program OmpAtomic168 169subroutine more_invalid_atomic_update_stmts()170    integer :: a, b, c171    integer :: d(10)172    real :: x, y, z(10)173    type some_type174        real :: m175        real :: n(10)176    end type177    type(some_type) p178    179    !$omp atomic180        x = x181 182    !$omp atomic update183    !ERROR: This is not a valid ATOMIC UPDATE operation184        x = 1    185 186    !$omp atomic update187    !ERROR: The atomic variable a cannot be a proper subexpression of an argument (here: a*b) in the update operation188        a = a * b + a189 190    !$omp atomic191    !ERROR: The atomic variable a cannot be a proper subexpression of an argument (here: (a+9_4)) in the update operation192    !ERROR: The atomic variable a should appear as an argument of the top-level * operator193        a = b * (a + 9)194 195    !$omp atomic update196    !ERROR: The atomic variable a cannot be a proper subexpression of an argument (here: (a+b)) in the update operation197        a = a * (a + b)198 199    !$omp atomic200    !ERROR: The atomic variable a cannot be a proper subexpression of an argument (here: (b+a)) in the update operation201        a = (b + a) * a202 203    !$omp atomic204    !ERROR: The atomic variable a cannot be a proper subexpression of an argument (here: a*b) in the update operation205    !ERROR: The atomic variable a should appear as an argument of the top-level + operator206        a = a * b + c207 208    !This is expected to work due to reassociation.209    !$omp atomic update210        a = a + b + c211 212    !$omp atomic213        a = b * c + a214 215    !$omp atomic update216        a = c + b + a217 218    !$omp atomic219    !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)220        a = a + d221 222    !$omp atomic update223    !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)224    !ERROR: The atomic variable x cannot be a proper subexpression of an argument (here: x*y) in the update operation225    !ERROR: The atomic variable x should appear as an argument of the top-level / operator226        x = x * y / z227 228    !$omp atomic229    !ERROR: The atomic variable p%m should appear as an argument of the top-level + operator230        p%m = x + y231 232    !$omp atomic update233    !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar REAL(4) and rank 1 array of REAL(4)234        p%m = p%m + p%n235end subroutine236