167 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 4.53! Various checks with the nesting of BARRIER construct4 5program omp_nest_barrier6 integer i, k, j7 k = 0;8 9 !$omp do10 do i = 1, 1011 k = k + 112 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.13 !$omp barrier14 j = j -115 end do16 17 !$omp do simd18 do i = 1, 1019 k = k + 120 !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 barrier23 j = j -124 end do25 26 !$omp parallel do27 do i = 1, 1028 k = k + 129 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.30 !$omp barrier31 j = j -132 end do33 34 !$omp parallel do simd35 do i = 1, 1036 k = k + 137 !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 barrier40 j = j -141 end do42 43 !$omp parallel44 do i = 1, 1045 k = k + 146 !$omp barrier47 j = j -148 end do49 !$omp end parallel50 51 !$omp task52 do i = 1, 1053 k = k + 154 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.55 !$omp barrier56 j = j -157 end do58 !$omp end task59 60 !$omp taskloop61 do i = 1, 1062 k = k + 163 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.64 !$omp barrier65 j = j -166 end do67 !$omp end taskloop68 69 !$omp critical70 do i = 1, 1071 k = k + 172 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.73 !$omp barrier74 j = j -175 end do76 !$omp end critical77 78 !$omp master79 do i = 1, 1080 k = k + 181 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.82 !$omp barrier83 j = j -184 end do85 !$omp end master86 87 !$omp ordered88 do i = 1, 1089 k = k + 190 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.91 !$omp barrier92 j = j -193 end do94 !$omp end ordered95 96 !$omp ordered97 do i = 1, 1098 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.99 !$omp distribute100 do k =1, 10101 print *, "hello"102 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.103 !$omp barrier104 j = j -1105 end do106 !$omp end distribute107 end do108 !$omp end ordered109 110 !$omp master111 do i = 1, 10112 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.113 !$omp distribute114 do k =1, 10115 print *, "hello"116 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.117 !$omp barrier118 j = j -1119 end do120 !$omp end distribute121 end do122 !$omp end master123 124 !$omp critical125 do i = 1, 10126 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.127 !$omp distribute128 do k =1, 10129 print *, "hello"130 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.131 !$omp barrier132 j = j -1133 end do134 !$omp end distribute135 end do136 !$omp end critical137 138 !$omp taskloop139 do i = 1, 10140 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.141 !$omp distribute142 do k =1, 10143 print *, "hello"144 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.145 !$omp barrier146 j = j -1147 end do148 !$omp end distribute149 end do150 !$omp end taskloop151 152 !$omp task153 do i = 1, 10154 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.155 !$omp distribute156 do k =1, 10157 print *, "hello"158 !ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region.159 !$omp barrier160 j = j -1161 end do162 !$omp end distribute163 end do164 !$omp end task165 166end program omp_nest_barrier167