1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
3 ! Check OpenMP 5.0 - 2.17.8 flush Construct
5 ! If memory-order-clause is release, acquire, or acq_rel, list items must not be specified on the flush directive.
14 real, DIMENSION(10) :: array
15 TYPE(someStruct
) :: structObj
18 !$omp parallel num_threads(4)
20 if (omp_get_thread_num() == 1) THEN
24 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
25 !Only memory-order-clauses.
26 if (omp_get_thread_num() == 1) THEN
27 ! Not allowed clauses.
28 !ERROR: SEQ_CST clause is not allowed on the FLUSH directive
30 !ERROR: RELAXED clause is not allowed on the FLUSH directive
33 ! Not allowed more than once.
34 !ERROR: At most one ACQ_REL clause can appear on the FLUSH directive
35 !$omp flush acq_rel acq_rel
36 !ERROR: At most one RELEASE clause can appear on the FLUSH directive
37 !$omp flush release release
38 !ERROR: At most one ACQUIRE clause can appear on the FLUSH directive
39 !$omp flush acquire acquire
41 ! Mix of allowed and not allowed.
42 !ERROR: SEQ_CST clause is not allowed on the FLUSH directive
43 !$omp flush seq_cst acquire
46 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
47 ! No memory-order-clause only list-items.
48 if (omp_get_thread_num() == 2) THEN
51 !$omp flush (array, structObj%rr)
52 ! Too many flush with repeating list items.
53 !$omp flush (i, a, b, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, b, b, b, b)
54 !ERROR: No explicit type declared for 'notpresentitem'
55 !$omp flush (notPresentItem)
58 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
59 if (omp_get_thread_num() == 3) THEN
60 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
61 !$omp flush acq_rel (array)
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, a, i)
65 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
66 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
67 !$omp flush release (array)
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, a)
71 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)
72 !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive
73 !$omp flush acquire (array)
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, a, structObj%rr)
79 !$omp parallel num_threads(4)
80 array
= (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)