brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · a7b170d Raw
87 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=514 5! Check OpenMP 5.0 - 2.17.8 flush Construct6! Restriction -7! If memory-order-clause is release, acquire, or acq_rel, list items must not be specified on the flush directive.8 9use omp_lib10  implicit none11 12  TYPE someStruct13    REAL :: rr14  end TYPE15  integer :: i, a, b16  real, DIMENSION(10) :: array17  TYPE(someStruct) :: structObj18 19  a = 1.020  !$omp parallel num_threads(4)21  !No list flushes all.22  if (omp_get_thread_num() == 1) THEN23    !$omp flush24  END IF25 26  array = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)27  !Only memory-order-clauses.28  if (omp_get_thread_num() == 1) THEN29    ! Not allowed clauses.30    !$omp flush seq_cst31    !ERROR: RELAXED clause is not allowed on the FLUSH directive32    !$omp flush relaxed33 34    ! Not allowed more than once.35    !ERROR: At most one ACQ_REL clause can appear on the FLUSH directive36    !$omp flush acq_rel acq_rel37    !ERROR: At most one RELEASE clause can appear on the FLUSH directive38    !$omp flush release release39    !ERROR: At most one ACQUIRE clause can appear on the FLUSH directive40    !$omp flush acquire acquire41 42    ! Mix of allowed and not allowed.43    !$omp flush seq_cst acquire44  END IF45 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) THEN49    !$omp flush (a)50    !$omp flush (i, a, b)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)56  END IF57 58  array = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)59  if (omp_get_thread_num() == 3) THEN60    !ERROR: If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items must not be specified on the FLUSH directive61    !$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 directive63    !$omp flush acq_rel (array, a, i)64 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 directive67    !$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 directive69    !$omp flush release (array, a)70 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 directive73    !$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 directive75    !$omp flush acquire (array, a, structObj%rr)76  END IF77  !$omp end parallel78 79  !$omp parallel num_threads(4)80    array = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/)81    !$omp master82      !$omp flush (array)83    !$omp end master84  !$omp end parallel85end86 87