https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128476
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Actually, the problem seems to be the following:
!$omp teams // -> 'private(i, j)' added
do i = 1, 5
do j = 1, 2
end do
end do
!$omp end teams
while
!$omp teams // -> no clause added; i is lastprivate in '!$omp loop'.
!$omp loop
do i = 1, 5; end do
!$omp end teams
Likewise fine:
!$omp teams // -> private(j)
!$omp loop
do i = 1, 5
do j = 1, 2
end do
end do
!$omp end teams
However, when there is an 'omp loop' on both 'do'-loops, GCC generates the
bogus 'private(j)'. Seemingly, the algorithm does not handle seeing two loops
associated with 'teams'.