brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · dddaa35 Raw
85 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp2! OpenMP Version 4.53! 2.7.4 workshare Construct4! The !omp workshare construct must not contain any user defined5! function calls unless the function is ELEMENTAL.6 7module my_mod8  contains9  integer function my_func()10    my_func = 1011  end function my_func12 13  impure integer function impure_my_func()14    impure_my_func = 2015  end function impure_my_func16 17  impure elemental integer function impure_ele_my_func()18    impure_ele_my_func = 2019  end function impure_ele_my_func20end module my_mod21 22subroutine workshare(aa, bb, cc, dd, ee, ff, n)23  use my_mod24  integer n, i, j25  real aa(n), bb(n), cc(n), dd(n), ee(n), ff(n)26 27  !$omp workshare28  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct29  aa = my_func()30  cc = dd31  ee = ff32 33  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct34  where (aa .ne. my_func()) aa = bb * cc35  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct36  where (dd .lt. 5) dd = aa * my_func()37 38  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct39  where (aa .ge. my_func())40    !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct41    cc = aa + my_func()42  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct43  elsewhere (aa .le. my_func())44    !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct45    cc = dd + my_func()46  elsewhere47    !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct48    cc = ee + my_func()49  end where50 51  !WARNING: Impure procedure 'my_func' should not be referenced in a FORALL header52  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct53  forall (j = 1:my_func()) aa(j) = aa(j) + bb(j)54 55  forall (j = 1:10)56    aa(j) = aa(j) + bb(j)57 58    !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct59    where (cc .le. j) cc = cc + my_func()60  end forall61 62  !$omp atomic update63  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct64  j = j + my_func()65 66  !$omp atomic capture67  i = j68  !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct69  j = j - my_func()70  !$omp end atomic71 72  !ERROR: User defined IMPURE, non-ELEMENTAL function 'impure_my_func' is not allowed in a WORKSHARE construct73  cc = impure_my_func()74  !ERROR: User defined IMPURE function 'impure_ele_my_func' is not allowed in a WORKSHARE construct75  aa(1) = impure_ele_my_func()76 77  !$omp end workshare78 79  !$omp workshare80    j = j + 181  !ERROR: At most one NOWAIT clause can appear on the END WORKSHARE directive82  !$omp end workshare nowait nowait83 84end subroutine workshare85