[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenMP / omp-workshare02.f90
blobe099ecb9f1e6141ac2413ef881028e66437ef4ce
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! OpenMP Version 4.5
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.
7 module my_mod
8 contains
9 integer function my_func()
10 my_func = 10
11 end function my_func
12 end module my_mod
14 subroutine workshare(aa, bb, cc, dd, ee, ff, n)
15 use my_mod
16 integer n, i, j
17 real aa(n), bb(n), cc(n), dd(n), ee(n), ff(n)
19 !$omp workshare
20 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
21 aa = my_func()
22 cc = dd
23 ee = ff
25 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
26 where (aa .ne. my_func()) aa = bb * cc
27 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
28 where (dd .lt. 5) dd = aa * my_func()
30 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
31 where (aa .ge. my_func())
32 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
33 cc = aa + my_func()
34 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
35 elsewhere (aa .le. my_func())
36 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
37 cc = dd + my_func()
38 elsewhere
39 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
40 cc = ee + my_func()
41 end where
43 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
44 forall (j = 1:my_func()) aa(j) = aa(j) + bb(j)
46 forall (j = 1:10)
47 aa(j) = aa(j) + bb(j)
49 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
50 where (cc .le. j) cc = cc + my_func()
51 end forall
53 !$omp atomic update
54 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
55 j = j + my_func()
57 !$omp atomic capture
58 i = j
59 !ERROR: User defined non-ELEMENTAL function 'my_func' is not allowed in a WORKSHARE construct
60 j = j - my_func()
61 !$omp end atomic
63 !$omp end workshare
65 end subroutine workshare