xref: /llvm-project/flang/test/Semantics/OpenMP/flush01.f90 (revision 502bea25bdc07d1811b8bfea1c2e6bfa8617f72f)
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2
3! 2.17.8 Flush construct [OpenMP 5.0]
4!        memory-order-clause ->
5!                               acq_rel
6!                               release
7!                               acquire
8use omp_lib
9  implicit none
10
11  integer :: i, a, b
12  real, DIMENSION(10) :: array
13
14  a = 1.0
15  !$omp parallel num_threads(4)
16  !Only memory-order-clauses.
17  if (omp_get_thread_num() == 1) then
18    ! Allowed clauses.
19    !$omp flush acq_rel
20    array = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
21    !$omp flush release
22    array = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
23    !$omp flush acquire
24
25    !ERROR: expected end of line
26    !$omp flush private(array)
27    !ERROR: expected end of line
28    !$omp flush num_threads(4)
29
30    ! Mix allowed and not allowed clauses.
31    !ERROR: expected end of line
32    !$omp flush num_threads(4) acquire
33  end if
34  !$omp end parallel
35end
36
37