brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 8ae261c Raw
92 lines · plain
1!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=602 3subroutine f004  integer :: x, y5 6  ! The x is a direct argument of the + operator. Expect no diagnostics.7  !$omp atomic update8  x = x + (y - 1)9end10 11subroutine f0112  integer :: x13 14  ! x + 0 is unusual, but legal. Expect no diagnostics.15  !$omp atomic update16  x = x + 017end18 19subroutine f0220  integer :: x21 22  ! This is formally not allowed by the syntax restrictions of the spec,23  ! but it's equivalent to either x+0 or x*1, both of which are legal.24  ! Allow this case. Expect no diagnostics.25  !$omp atomic update26  x = x27end28 29subroutine f0330  integer :: x, y31  real :: xr, yr32 33  !With integer type the reassociation should be able to bring the `x` to34  !the top of the + operator. Expect no diagnostics.35  !$omp atomic update36  x = (x + y) + 137 38  !Real variables cannot be reassociated (unless fastmath options are present).39  !$omp atomic update40  !ERROR: The atomic variable xr cannot be a proper subexpression of an argument (here: (xr+yr)) in the update operation41  !ERROR: The atomic variable xr should appear as an argument of the top-level + operator42  xr = (xr + yr) + 143end44 45subroutine f0446  integer :: x47  real :: y48 49  !$omp atomic update50  !ERROR: This intrinsic function is not a valid ATOMIC UPDATE operation51  x = floor(x + y)52end53 54subroutine f0555  integer :: x56  real :: y57 58  ! An explicit conversion is accepted as an extension.59  !$omp atomic update60  x = int(x + y)61end62 63subroutine f0664  integer :: x, y65  interface66    function f(i, j)67      integer :: f, i, j68    end69  end interface70 71  !$omp atomic update72  !ERROR: A call to this function is not a valid ATOMIC UPDATE operation73  x = f(x, y)74end75 76subroutine f0777  real :: x78  integer :: y79 80  !$omp atomic update81  !ERROR: The ** operator is not a valid ATOMIC UPDATE operation82  x = x ** y83end84 85subroutine f0886  integer :: x, y87 88  !$omp atomic update89  !ERROR: The atomic variable x should appear as an argument in the update operation90  x = y91end92