13323a4bdSKiran Chandramohan! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp 23323a4bdSKiran Chandramohan! OpenMP Version 4.5 33323a4bdSKiran Chandramohan! 2.15.3.6 Reduction Clause 43323a4bdSKiran Chandramohanprogram omp_reduction 53323a4bdSKiran Chandramohan 63323a4bdSKiran Chandramohan integer :: a,i,j,l 73323a4bdSKiran Chandramohan integer :: k = 10 83323a4bdSKiran Chandramohan !$omp parallel private(k) 93323a4bdSKiran Chandramohan !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. 103323a4bdSKiran Chandramohan !$omp do reduction(+:k) 113323a4bdSKiran Chandramohan do i = 1, 10 123323a4bdSKiran Chandramohan k = k + 1 133323a4bdSKiran Chandramohan end do 143323a4bdSKiran Chandramohan !$omp end do 153323a4bdSKiran Chandramohan !$omp end parallel 163323a4bdSKiran Chandramohan 173323a4bdSKiran Chandramohan 183323a4bdSKiran Chandramohan !$omp parallel private(j),reduction(+:k) 193323a4bdSKiran Chandramohan !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. 203323a4bdSKiran Chandramohan !$omp do reduction(+:k) 213323a4bdSKiran Chandramohan do i = 1, 10 223323a4bdSKiran Chandramohan k = k + 1 233323a4bdSKiran Chandramohan end do 243323a4bdSKiran Chandramohan !$omp end do 253323a4bdSKiran Chandramohan !$omp end parallel 263323a4bdSKiran Chandramohan 273323a4bdSKiran Chandramohan !$omp parallel private(j),firstprivate(k) 283323a4bdSKiran Chandramohan !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. 293323a4bdSKiran Chandramohan !$omp do reduction(min:k) 303323a4bdSKiran Chandramohan do i = 1, 10 313323a4bdSKiran Chandramohan k = k + 1 323323a4bdSKiran Chandramohan end do 333323a4bdSKiran Chandramohan !$omp end do 343323a4bdSKiran Chandramohan !$omp end parallel 353323a4bdSKiran Chandramohan 363323a4bdSKiran Chandramohan 373323a4bdSKiran Chandramohan !$omp parallel private(l,j),firstprivate(k) 383323a4bdSKiran Chandramohan !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. 393323a4bdSKiran Chandramohan !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. 403323a4bdSKiran Chandramohan !$omp sections reduction(ior:k) reduction(*:j) 413323a4bdSKiran Chandramohan do i = 1, 10 423323a4bdSKiran Chandramohan k = ior(k, 1) 433323a4bdSKiran Chandramohan j = j * 3 443323a4bdSKiran Chandramohan end do 453323a4bdSKiran Chandramohan !$omp end sections 463323a4bdSKiran Chandramohan !$omp end parallel 473323a4bdSKiran Chandramohan 483323a4bdSKiran Chandramohan!$omp sections private(k) 493323a4bdSKiran Chandramohan !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region 503323a4bdSKiran Chandramohan !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. 513323a4bdSKiran Chandramohan !$omp do reduction(+:k) reduction(max:j) 523323a4bdSKiran Chandramohan do i = 1, 10 533323a4bdSKiran Chandramohan k = k + 1 543323a4bdSKiran Chandramohan end do 553323a4bdSKiran Chandramohan !$omp end do 563323a4bdSKiran Chandramohan!$omp end sections 573323a4bdSKiran Chandramohan 583323a4bdSKiran Chandramohan!$omp sections private(k) 593323a4bdSKiran Chandramohan !$omp target 603323a4bdSKiran Chandramohan do j = 1,10 613323a4bdSKiran Chandramohan !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region 623323a4bdSKiran Chandramohan !$omp do reduction(+:k) reduction(max:j) 633323a4bdSKiran Chandramohan do i = 1, 10 643323a4bdSKiran Chandramohan k = k + 1 653323a4bdSKiran Chandramohan end do 663323a4bdSKiran Chandramohan !$omp end do 673323a4bdSKiran Chandramohan end do 683323a4bdSKiran Chandramohan !$omp end target 693323a4bdSKiran Chandramohan!$omp end sections 703323a4bdSKiran Chandramohan 713323a4bdSKiran Chandramohan!$omp parallel reduction(+:a) 723323a4bdSKiran Chandramohan!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. 733323a4bdSKiran Chandramohan!$omp sections reduction(*:a) 743323a4bdSKiran Chandramohana = a + 10 753323a4bdSKiran Chandramohan!$omp end sections 763323a4bdSKiran Chandramohan!$omp end parallel 773323a4bdSKiran Chandramohan 783323a4bdSKiran Chandramohan!$omp parallel reduction(*:a) 793323a4bdSKiran Chandramohan!$omp end parallel 803323a4bdSKiran Chandramohan 813323a4bdSKiran Chandramohan!$omp parallel reduction(ieor:a) 823323a4bdSKiran Chandramohan!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. 833323a4bdSKiran Chandramohan!$omp sections reduction(+:a) 843323a4bdSKiran Chandramohana = ieor(a, 10) 853323a4bdSKiran Chandramohan!$omp end sections 863323a4bdSKiran Chandramohan!$omp end parallel 873323a4bdSKiran Chandramohan 88*460c2eaaSKiran Chandramohan!$omp parallel private(a) 893323a4bdSKiran Chandramohan!$omp parallel reduction(ieor:a) 903323a4bdSKiran Chandramohan!$omp end parallel 91*460c2eaaSKiran Chandramohan!$omp end parallel 92*460c2eaaSKiran Chandramohan 93*460c2eaaSKiran Chandramohan!$omp task firstprivate(a) 94*460c2eaaSKiran Chandramohan!$omp parallel do reduction(+:a) 95*460c2eaaSKiran Chandramohando i=1,10 96*460c2eaaSKiran Chandramohan a=a+j 97*460c2eaaSKiran Chandramohanend do 98*460c2eaaSKiran Chandramohan!$omp end parallel do 99*460c2eaaSKiran Chandramohan!$omp end task 1003323a4bdSKiran Chandramohan 1013323a4bdSKiran Chandramohanend program omp_reduction 102