xref: /llvm-project/flang/test/Semantics/OpenMP/copying.f90 (revision 0ee6646d6fb3b0b9a3655b14bd1cbc18a4e99600)
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp -Werror -pedantic
2! OpenMP Version 5.0
3! 2.19.4.4 firstprivate Clause
4! 2.19.4.5 lastprivate Clause
5! 2.19.6.1 copyin Clause
6! 2.19.6.2 copyprivate Clause
7! If the list item is a polymorphic variable with the allocatable attribute,
8! the behavior is unspecified.
9
10subroutine firstprivate()
11  class(*), allocatable, save :: x
12
13  !PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in FIRSTPRIVATE clause, the behavior is unspecified
14  !$omp parallel firstprivate(x)
15    call sub()
16  !$omp end parallel
17
18end
19
20subroutine lastprivate()
21  class(*), allocatable, save :: x
22
23  !PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in LASTPRIVATE clause, the behavior is unspecified
24  !$omp do lastprivate(x)
25  do i = 1, 10
26    call sub()
27  enddo
28  !$omp end do
29
30end
31
32subroutine copyin()
33  class(*), allocatable, save :: x
34  !$omp threadprivate(x)
35
36  !PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in COPYIN clause, the behavior is unspecified
37  !$omp parallel copyin(x)
38    call sub()
39  !$omp end parallel
40
41end
42
43subroutine copyprivate()
44  class(*), allocatable, save :: x
45  !$omp threadprivate(x)
46
47  !$omp single
48    call sub()
49  !PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in COPYPRIVATE clause, the behavior is unspecified
50  !$omp end single copyprivate(x)
51
52end
53