1 ! REQUIRES: openmp_runtime
3 ! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=50
5 ! Check OpenMP 5.0 - 2.17.8 flush Construct
7 ! If memory-order-clause is release, acquire, or acq_rel, list items must not be specified on the flush directive.
16 real, DIMENSION(10) :: array
17 TYPE(someStruct
) :: structObj
20 !$omp parallel num_threads(4)
22 if (omp_get_thread_num() == 1) THEN
26 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
27 !Only memory-order-clauses.
28 if (omp_get_thread_num() == 1) THEN
29 ! Not allowed clauses.
30 !ERROR: SEQ_CST clause is not allowed on the FLUSH directive
32 !ERROR: RELAXED clause is not allowed on the FLUSH directive
35 ! Not allowed more than once.
36 !ERROR: At most one ACQ_REL clause can appear on the FLUSH directive
37 !$omp flush acq_rel acq_rel
38 !ERROR: At most one RELEASE clause can appear on the FLUSH directive
39 !$omp flush release release
40 !ERROR: At most one ACQUIRE clause can appear on the FLUSH directive
41 !$omp flush acquire acquire
43 ! Mix of allowed and not allowed.
44 !ERROR: SEQ_CST clause is not allowed on the FLUSH directive
45 !$omp flush seq_cst acquire
48 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
49 ! No memory-order-clause only list-items.
50 if (omp_get_thread_num() == 2) THEN
53 !$omp flush (array, structObj%rr)
54 ! Too many flush with repeating list items.
55 !$omp flush (i, a, b, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, b, b, b, b)
56 !ERROR: No explicit type declared for 'notpresentitem'
57 !$omp flush (notPresentItem)
60 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
61 if (omp_get_thread_num() == 3) THEN
62 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
63 !$omp flush acq_rel (array)
64 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
65 !$omp flush acq_rel (array, a, i)
67 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
68 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
69 !$omp flush release (array)
70 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
71 !$omp flush release (array, a)
73 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
74 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
75 !$omp flush acquire (array)
76 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
77 !$omp flush acquire (array, a, structObj%rr)
81 !$omp parallel num_threads(4)
82 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
83 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead.