1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp 2! OpenMP Version 4.5 3! Various checks with the nesting of BARRIER construct 4 5program omp_nest_barrier 6 integer i, k, j 7 k = 0; 8 9 !$omp do 10 do i = 1, 10 11 k = k + 1 12 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 13 !$omp barrier 14 j = j -1 15 end do 16 17 !$omp do simd 18 do i = 1, 10 19 k = k + 1 20 !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. 21 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 22 !$omp barrier 23 j = j -1 24 end do 25 26 !$omp parallel do 27 do i = 1, 10 28 k = k + 1 29 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 30 !$omp barrier 31 j = j -1 32 end do 33 34 !$omp parallel do simd 35 do i = 1, 10 36 k = k + 1 37 !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. 38 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 39 !$omp barrier 40 j = j -1 41 end do 42 43 !$omp parallel 44 do i = 1, 10 45 k = k + 1 46 !$omp barrier 47 j = j -1 48 end do 49 !$omp end parallel 50 51 !$omp task 52 do i = 1, 10 53 k = k + 1 54 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 55 !$omp barrier 56 j = j -1 57 end do 58 !$omp end task 59 60 !$omp taskloop 61 do i = 1, 10 62 k = k + 1 63 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 64 !$omp barrier 65 j = j -1 66 end do 67 !$omp end taskloop 68 69 !$omp critical 70 do i = 1, 10 71 k = k + 1 72 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 73 !$omp barrier 74 j = j -1 75 end do 76 !$omp end critical 77 78 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. 79 !$omp master 80 do i = 1, 10 81 k = k + 1 82 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 83 !$omp barrier 84 j = j -1 85 end do 86 !$omp end master 87 88 !$omp ordered 89 do i = 1, 10 90 k = k + 1 91 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 92 !$omp barrier 93 j = j -1 94 end do 95 !$omp end ordered 96 97 !$omp ordered 98 do i = 1, 10 99 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. 100 !$omp distribute 101 do k =1, 10 102 print *, "hello" 103 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 104 !$omp barrier 105 j = j -1 106 end do 107 !$omp end distribute 108 end do 109 !$omp end ordered 110 111 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. 112 !$omp master 113 do i = 1, 10 114 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. 115 !$omp distribute 116 do k =1, 10 117 print *, "hello" 118 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 119 !$omp barrier 120 j = j -1 121 end do 122 !$omp end distribute 123 end do 124 !$omp end master 125 126 !$omp critical 127 do i = 1, 10 128 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. 129 !$omp distribute 130 do k =1, 10 131 print *, "hello" 132 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 133 !$omp barrier 134 j = j -1 135 end do 136 !$omp end distribute 137 end do 138 !$omp end critical 139 140 !$omp taskloop 141 do i = 1, 10 142 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. 143 !$omp distribute 144 do k =1, 10 145 print *, "hello" 146 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 147 !$omp barrier 148 j = j -1 149 end do 150 !$omp end distribute 151 end do 152 !$omp end taskloop 153 154 !$omp task 155 do i = 1, 10 156 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. 157 !$omp distribute 158 do k =1, 10 159 print *, "hello" 160 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. 161 !$omp barrier 162 j = j -1 163 end do 164 !$omp end distribute 165 end do 166 !$omp end task 167 168end program omp_nest_barrier 169