In this case the variable i should be shared except in the task construct that contains the do loop on i.
Test case: program F03_2_9_1_1_5a use omp_lib implicit none integer, parameter :: NT = 4 integer, parameter :: EXPECTED_RESULT = -1 ! expected value of i at end integer :: dummy_var, i = EXPECTED_RESULT call omp_set_dynamic(.false.) call omp_set_num_threads(NT) !$omp parallel !$omp single !$omp task !$omp task ! i should be private in this task region (OMP 3.0, [78:26-27]) do i = 1,NT dummy_var = omp_get_thread_num() ! give the loop something to do end do !$omp end task !$omp taskwait ! wait for the explicit task to finish ! i should be shared in this task region (OMP 3.0, [79:31-33]) if (i /= EXPECTED_RESULT) then print *, 'FAIL (in task construct) - i == ', i , ' (expected ', & EXPECTED_RESULT, ')' end if !$omp end task !$omp end single ! implicit barrier ensures all tasks have finished ! i should be shared in this parallel region (OMP 3.0, [79:27-28]) if (i /= EXPECTED_RESULT) then print *, 'FAIL (in parallel construct) - i == ', i , ' (expected ', & EXPECTED_RESULT, ')' end if !$omp end parallel end program F03_2_9_1_1_5a > gfortran -fopenmp test.f90 > ./a.out FAIL (in task construct) - i == 0 (expected -1 ) FAIL (in parallel construct) - i == 32767 (expected -1 ) FAIL (in parallel construct) - i == 0 (expected -1 ) FAIL (in parallel construct) - i == 0 (expected -1 ) FAIL (in parallel construct) - i == 10941 (expected -1 ) -- Summary: Incorrect output for pgm checking data sharing attributes Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: longb at cray dot com GCC build triplet: x86_64-suse-linux GCC host triplet: x86_64-suse-linux GCC target triplet: x86_64-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43339