xref: /llvm-project/flang/test/Semantics/OpenMP/private-assoc.f90 (revision 20c5432d0fb4ac852482141d89287e3fcc2d1278)
1*20c5432dSTom Eccles! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2*20c5432dSTom Eccles
3*20c5432dSTom Eccles! The ASSOCIATE name preserves the association with the selector established
4*20c5432dSTom Eccles! in the associate statement. Therefore it is incorrect to change the
5*20c5432dSTom Eccles! data-sharing attribute of the name.
6*20c5432dSTom Eccles
7*20c5432dSTom Ecclessubroutine assoc_private(x)
8*20c5432dSTom Eccles  integer :: x
9*20c5432dSTom Eccles  associate(z => x)
10*20c5432dSTom Eccles  !ERROR: Variable 'z' in ASSOCIATE cannot be in a PRIVATE clause
11*20c5432dSTom Eccles  !$omp parallel private(z)
12*20c5432dSTom Eccles  !$omp end parallel
13*20c5432dSTom Eccles  end associate
14*20c5432dSTom Ecclesend subroutine
15*20c5432dSTom Eccles
16*20c5432dSTom Ecclessubroutine assoc_firstprivate(x)
17*20c5432dSTom Eccles  integer :: x
18*20c5432dSTom Eccles  associate(z => x)
19*20c5432dSTom Eccles  !ERROR: Variable 'z' in ASSOCIATE cannot be in a FIRSTPRIVATE clause
20*20c5432dSTom Eccles  !$omp parallel firstprivate(z)
21*20c5432dSTom Eccles  !$omp end parallel
22*20c5432dSTom Eccles  end associate
23*20c5432dSTom Ecclesend subroutine
24*20c5432dSTom Eccles
25*20c5432dSTom Ecclessubroutine assoc_lastprivate(x)
26*20c5432dSTom Eccles  integer :: x
27*20c5432dSTom Eccles  associate(z => x)
28*20c5432dSTom Eccles  !ERROR: Variable 'z' in ASSOCIATE cannot be in a LASTPRIVATE clause
29*20c5432dSTom Eccles  !$omp parallel sections lastprivate(z)
30*20c5432dSTom Eccles  !$omp end parallel sections
31*20c5432dSTom Eccles  end associate
32*20c5432dSTom Ecclesend subroutine
33