Open
Description
module test_mod
complex :: tm3a/(0,0)/
contains
subroutine f4()
!$omp task
!$omp task
tm3a = (1, 2)
!$omp end task
!$omp end task
!$omp taskwait
print *,tm3a
end subroutine
end module
program main
use test_mod
call f4()
end program
flang -fopenmp test.f90 -o out && ./out
This should print (1, 2)
not (0, 0)
. The problem that flang is currently setting tm3a
to FIRSTPRIVATE.
The relevant section is 7.1.1 of OpenMP 6.0.
There is one rule saying that variables with static storage duration are predetermined as SHARED. Another rule for implicitly determined DSA, "in a task-generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above is firstprivate".
My interpretation of this is that the rule for predetermined DSA takes precedence and tm3a
should be SHARED.