1! RUN: %python %S/../test_errors.py %s %flang -fopenmp 2! OpenMP Version 4.5 3! Various checks with the ordered construct 4 5SUBROUTINE WORK(I) 6 INTEGER I 7END SUBROUTINE WORK 8 9SUBROUTINE ORDERED_GOOD(N) 10 INTEGER N, I, A(10), B(10), C(10) 11 !$OMP SIMD 12 DO I = 1,N 13 IF (I <= 10) THEN 14 !$OMP ORDERED SIMD 15 CALL WORK(I) 16 !$OMP END ORDERED 17 ENDIF 18 END DO 19 !$OMP END SIMD 20END SUBROUTINE ORDERED_GOOD 21 22SUBROUTINE ORDERED_BAD(N) 23 INTEGER N, I, A(10), B(10), C(10) 24 25 !$OMP DO SIMD 26 DO I = 1,N 27 IF (I <= 10) THEN 28 !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 parameter 30 !$OMP ORDERED 31 CALL WORK(I) 32 !$OMP END ORDERED 33 ENDIF 34 END DO 35 !$OMP END DO SIMD 36 37 !$OMP PARALLEL DO 38 DO I = 1,N 39 IF (I <= 10) THEN 40 !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 parameter 41 !$OMP ORDERED 42 CALL WORK(I) 43 !$OMP END ORDERED 44 ENDIF 45 END DO 46 !$OMP END PARALLEL DO 47 48 !$OMP CRITICAL 49 DO I = 1,N 50 IF (I <= 10) THEN 51 !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 ORDERED 55 ENDIF 56 END DO 57 !$OMP END CRITICAL 58 59 !$OMP CRITICAL 60 WRITE(*,*) I 61 !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 ORDERED 65 !$OMP END CRITICAL 66 67 !$OMP ORDERED 68 WRITE(*,*) I 69 IF (I <= 10) THEN 70 !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 ORDERED 74 ENDIF 75 !$OMP END ORDERED 76 77 !$OMP TASK 78 C = C - A * B 79 !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 ORDERED 83 !$OMP END TASK 84 85 !$OMP TASKLOOP 86 DO I = 1,N 87 IF (I <= 10) THEN 88 !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 ORDERED 92 ENDIF 93 END DO 94 !$OMP END TASKLOOP 95 96 !$OMP CRITICAL 97 C = C - A * B 98 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. 99 !$OMP MASTER 100 DO I = 1,N 101 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region. 102 !$OMP ORDERED 103 CALL WORK(I) 104 !$OMP END ORDERED 105 END DO 106 !$OMP END MASTER 107 !$OMP END CRITICAL 108 109 !$OMP ORDERED 110 C = C - A * B 111 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. 112 !$OMP MASTER 113 DO I = 1,N 114 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region. 115 !$OMP ORDERED 116 CALL WORK(I) 117 !$OMP END ORDERED 118 END DO 119 !$OMP END MASTER 120 !$OMP END ORDERED 121 122 !$OMP TASK 123 C = C - A * B 124 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. 125 !ERROR: `MASTER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`, or `ATOMIC` region. 126 !$OMP MASTER 127 DO I = 1,N 128 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region. 129 !$OMP ORDERED 130 CALL WORK(I) 131 !$OMP END ORDERED 132 END DO 133 !$OMP END MASTER 134 !$OMP END TASK 135 136 !$OMP TASKLOOP 137 DO J= 1,N 138 C = C - A * B 139 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. 140 !ERROR: `MASTER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`, or `ATOMIC` region. 141 !$OMP MASTER 142 DO I = 1,N 143 !ERROR: `ORDERED` region may not be closely nested inside of `CRITICAL`, `ORDERED`, explicit `TASK` or `TASKLOOP` region. 144 !$OMP ORDERED 145 CALL WORK(I) 146 !$OMP END ORDERED 147 END DO 148 !$OMP END MASTER 149 END DO 150 !$OMP END TASKLOOP 151 152END SUBROUTINE ORDERED_BAD 153