1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
3 ! 2.7.4 workshare Construct
4 ! The !omp workshare construct must not contain any user defined
5 ! function calls unless the function is ELEMENTAL.
9 integer function my_func()
13 impure
integer function impure_my_func()
15 end function impure_my_func
17 impure elemental
integer function impure_ele_my_func()
18 impure_ele_my_func
= 20
19 end function impure_ele_my_func
22 subroutine workshare(aa
, bb
, cc
, dd
, ee
, ff
, n
)
25 real aa(n
), bb(n
), cc(n
), dd(n
), ee(n
), ff(n
)
28 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
33 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
34 where (aa
.ne
. my_func()) aa
= bb
* cc
35 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
36 where (dd
.lt
. 5) dd
= aa
* my_func()
38 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
39 where (aa
.ge
. my_func())
40 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
42 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
43 elsewhere (aa
.le
. my_func())
44 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
47 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
51 !WARNING: Impure procedure 'my_func' should not be referenced in a FORALL header
52 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
53 forall (j
= 1:my_func()) aa(j
) = aa(j
) + bb(j
)
58 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
59 where (cc
.le
. j
) cc
= cc
+ my_func()
63 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
68 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
72 !ERROR: User defined IMPURE, non-ELEMENTAL function 'impure_my_func' is not allowed in a WORKSHARE construct
74 !ERROR: User defined IMPURE function 'impure_ele_my_func' is not allowed in a WORKSHARE construct
75 aa(1) = impure_ele_my_func()
81 !ERROR: At most one NOWAIT clause can appear on the END WORKSHARE directive
82 !$omp end workshare nowait nowait
84 end subroutine workshare