149 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp2! OpenMP Version 4.53! Various checks with the ordered construct4 5SUBROUTINE WORK(I)6 INTEGER I7END SUBROUTINE WORK8 9SUBROUTINE ORDERED_GOOD(N)10 INTEGER N, I, A(10), B(10), C(10) 11 !$OMP SIMD12 DO I = 1,N13 IF (I <= 10) THEN14 !$OMP ORDERED SIMD15 CALL WORK(I)16 !$OMP END ORDERED17 ENDIF18 END DO19 !$OMP END SIMD20END SUBROUTINE ORDERED_GOOD21 22SUBROUTINE ORDERED_BAD(N)23 INTEGER N, I, A(10), B(10), C(10)24 25 !$OMP DO SIMD26 DO I = 1,N27 IF (I <= 10) THEN28 !ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct, the `SCAN` construct and the `ORDERED` construct with the `SIMD` clause.29 !ERROR: An ORDERED directive without the DEPEND clause must be closely nested in a worksharing-loop (or worksharing-loop SIMD) region with ORDERED clause without the parameter30 !$OMP ORDERED 31 CALL WORK(I)32 !$OMP END ORDERED33 ENDIF34 END DO35 !$OMP END DO SIMD36 37 !$OMP PARALLEL DO38 DO I = 1,N39 IF (I <= 10) THEN40 !ERROR: An ORDERED directive without the DEPEND clause must be closely nested in a worksharing-loop (or worksharing-loop SIMD) region with ORDERED clause without the parameter41 !$OMP ORDERED 42 CALL WORK(I)43 !$OMP END ORDERED44 ENDIF45 END DO46 !$OMP END PARALLEL DO47 48 !$OMP CRITICAL 49 DO I = 1,N50 IF (I <= 10) THEN51 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.52 !$OMP ORDERED 53 CALL WORK(I)54 !$OMP END ORDERED55 ENDIF56 END DO57 !$OMP END CRITICAL58 59 !$OMP CRITICAL60 WRITE(*,*) I61 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.62 !$OMP ORDERED 63 CALL WORK(I)64 !$OMP END ORDERED65 !$OMP END CRITICAL66 67 !$OMP ORDERED 68 WRITE(*,*) I69 IF (I <= 10) THEN70 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.71 !$OMP ORDERED 72 CALL WORK(I)73 !$OMP END ORDERED74 ENDIF75 !$OMP END ORDERED76 77 !$OMP TASK 78 C = C - A * B79 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.80 !$OMP ORDERED 81 CALL WORK(I)82 !$OMP END ORDERED83 !$OMP END TASK84 85 !$OMP TASKLOOP 86 DO I = 1,N87 IF (I <= 10) THEN88 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.89 !$OMP ORDERED 90 CALL WORK(I)91 !$OMP END ORDERED92 ENDIF93 END DO94 !$OMP END TASKLOOP95 96 !$OMP CRITICAL 97 C = C - A * B98 !$OMP MASTER99 DO I = 1,N100 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.101 !$OMP ORDERED 102 CALL WORK(I)103 !$OMP END ORDERED104 END DO105 !$OMP END MASTER106 !$OMP END CRITICAL107 108 !$OMP ORDERED 109 C = C - A * B110 !$OMP MASTER111 DO I = 1,N112 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.113 !$OMP ORDERED 114 CALL WORK(I)115 !$OMP END ORDERED116 END DO117 !$OMP END MASTER118 !$OMP END ORDERED119 120 !$OMP TASK 121 C = C - A * B122 !ERROR: `MASTER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`, or `ATOMIC` region.123 !$OMP MASTER124 DO I = 1,N125 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.126 !$OMP ORDERED 127 CALL WORK(I)128 !$OMP END ORDERED129 END DO130 !$OMP END MASTER131 !$OMP END TASK132 133 !$OMP TASKLOOP134 DO J= 1,N 135 C = C - A * B136 !ERROR: `MASTER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`, or `ATOMIC` region.137 !$OMP MASTER138 DO I = 1,N139 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region.140 !$OMP ORDERED 141 CALL WORK(I)142 !$OMP END ORDERED143 END DO144 !$OMP END MASTER145 END DO146 !$OMP END TASKLOOP147 148END SUBROUTINE ORDERED_BAD149