xref: /llvm-project/flang/test/Semantics/OpenMP/resolve06.f90 (revision cdbd22876b71acad9e5eeceadc0d8859e6e73b18)
1fb5fd2d8SMichael Klemm! REQUIRES: openmp_runtime
2fb5fd2d8SMichael Klemm
3*cdbd2287SKrzysztof Parzyszek! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
43323a4bdSKiran Chandramohanuse omp_lib
53323a4bdSKiran Chandramohan!2.11.4 Allocate Clause
63323a4bdSKiran Chandramohan!For any list item that is specified in the allocate
73323a4bdSKiran Chandramohan!clause on a directive, a data-sharing attribute clause
83323a4bdSKiran Chandramohan!that may create a private copy of that list item must be
93323a4bdSKiran Chandramohan!specified on the same directive.
103323a4bdSKiran Chandramohan
113323a4bdSKiran Chandramohan  integer ::  N = 2
123323a4bdSKiran Chandramohan
133323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'x' must be listed in a private data-sharing attribute clause on the same directive
143323a4bdSKiran Chandramohan  !$omp parallel allocate(omp_default_mem_space : x)
153323a4bdSKiran Chandramohan  do i = 1, N
163323a4bdSKiran Chandramohan     x = 2
173323a4bdSKiran Chandramohan  enddo
183323a4bdSKiran Chandramohan  !$omp end parallel
193323a4bdSKiran Chandramohan
203323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'y' must be listed in a private data-sharing attribute clause on the same directive
213323a4bdSKiran Chandramohan  !$omp parallel allocate(omp_default_mem_space : y) firstprivate(x)
223323a4bdSKiran Chandramohan  do i = 1, N
233323a4bdSKiran Chandramohan     x = 2
243323a4bdSKiran Chandramohan  enddo
253323a4bdSKiran Chandramohan  !$omp end parallel
263323a4bdSKiran Chandramohan
273323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'x' must be listed in a private data-sharing attribute clause on the same directive
283323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'x' must be listed in a private data-sharing attribute clause on the same directive
293323a4bdSKiran Chandramohan  !$omp parallel allocate(omp_default_mem_space : x) allocate(omp_default_mem_space : x)
303323a4bdSKiran Chandramohan  do i = 1, N
313323a4bdSKiran Chandramohan     x = 2
323323a4bdSKiran Chandramohan  enddo
333323a4bdSKiran Chandramohan  !$omp end parallel
343323a4bdSKiran Chandramohan
353323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'f' must be listed in a private data-sharing attribute clause on the same directive
363323a4bdSKiran Chandramohan  !$omp parallel allocate(omp_default_mem_space : f) shared(f)
373323a4bdSKiran Chandramohan  do i = 1, N
383323a4bdSKiran Chandramohan     x = 2
393323a4bdSKiran Chandramohan  enddo
403323a4bdSKiran Chandramohan  !$omp end parallel
413323a4bdSKiran Chandramohan
423323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'q' must be listed in a private data-sharing attribute clause on the same directive
433323a4bdSKiran Chandramohan  !$omp parallel private(t) allocate(omp_default_mem_space : z, t, q, r) firstprivate(z, r)
443323a4bdSKiran Chandramohan  do i = 1, N
453323a4bdSKiran Chandramohan     x = 2
463323a4bdSKiran Chandramohan  enddo
473323a4bdSKiran Chandramohan  !$omp end parallel
483323a4bdSKiran Chandramohan
493323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'b' must be listed in a private data-sharing attribute clause on the same directive
503323a4bdSKiran Chandramohan  !ERROR: The ALLOCATE clause requires that 'c' must be listed in a private data-sharing attribute clause on the same directive
513323a4bdSKiran Chandramohan  !$omp parallel allocate(omp_default_mem_space : a, b, c, d) firstprivate(a, d)
523323a4bdSKiran Chandramohan  do i = 1, N
533323a4bdSKiran Chandramohan     x = 2
543323a4bdSKiran Chandramohan  enddo
553323a4bdSKiran Chandramohan  !$omp end parallel
563323a4bdSKiran Chandramohanend
57