102 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 4.53! 2.15.3.6 Reduction Clause4program omp_reduction5 6 integer :: a,i,j,l7 integer :: k = 108 !$omp parallel private(k)9 !ERROR: REDUCTION variable 'k' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.10 !$omp do reduction(+:k)11 do i = 1, 1012 k = k + 113 end do14 !$omp end do15 !$omp end parallel16 17 18 !$omp parallel private(j),reduction(+:k)19 !ERROR: REDUCTION variable 'k' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.20 !$omp do reduction(+:k)21 do i = 1, 1022 k = k + 123 end do24 !$omp end do25 !$omp end parallel26 27 !$omp parallel private(j),firstprivate(k)28 !ERROR: REDUCTION variable 'k' is FIRSTPRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.29 !$omp do reduction(min:k)30 do i = 1, 1031 k = k + 132 end do33 !$omp end do34 !$omp end parallel35 36 37 !$omp parallel private(l,j),firstprivate(k)38 !ERROR: REDUCTION variable 'k' is FIRSTPRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.39 !ERROR: REDUCTION variable 'j' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.40 !$omp sections reduction(ior:k) reduction(*:j)41 do i = 1, 1042 k = ior(k, 1)43 j = j * 344 end do45 !$omp end sections46 !$omp end parallel47 48!$omp sections private(k)49 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region50 !ERROR: REDUCTION variable 'k' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.51 !$omp do reduction(+:k) reduction(max:j)52 do i = 1, 1053 k = k + 154 end do55 !$omp end do56!$omp end sections57 58!$omp sections private(k)59 !$omp target60 do j = 1,1061 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region62 !$omp do reduction(+:k) reduction(max:j)63 do i = 1, 1064 k = k + 165 end do66 !$omp end do67 end do68 !$omp end target69!$omp end sections70 71!$omp parallel reduction(+:a)72!ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.73!$omp sections reduction(*:a)74a = a + 1075!$omp end sections76!$omp end parallel77 78!$omp parallel reduction(*:a)79!$omp end parallel80 81!$omp parallel reduction(ieor:a)82!ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.83!$omp sections reduction(+:a)84a = ieor(a, 10)85!$omp end sections86!$omp end parallel87 88!$omp parallel private(a)89!$omp parallel reduction(ieor:a)90!$omp end parallel91!$omp end parallel92 93!$omp task firstprivate(a)94!$omp parallel do reduction(+:a)95do i=1,1096 a=a+j97end do98!$omp end parallel do99!$omp end task100 101end program omp_reduction102