-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorflang:irflang:openmp
Description
flang-compiler#1136 has the detailed info about the support status of Threadprivate directive.
Test case
$ cat hostassoc1.f90
program main
use omp_lib
integer, save :: a
!$omp threadprivate(a)
call sub()
contains
subroutine sub()
a = 2
!$omp parallel num_threads(4)
a = omp_get_thread_num()
print *, a, omp_get_thread_num()
!$omp end parallel
!$omp parallel num_threads(4)
print *, a, omp_get_thread_num()
!$omp end parallel
end
end
$ cat hostassoc2.f90
program main
use omp_lib
integer :: a
!$omp threadprivate(a)
call sub()
contains
subroutine sub()
a = 2
!$omp parallel num_threads(4)
a = omp_get_thread_num()
print *, a, omp_get_thread_num()
!$omp end parallel
!$omp parallel num_threads(4)
print *, a, omp_get_thread_num()
!$omp end parallel
end
end
Expected results:
0 0
2 2
3 3
1 1
2 2
3 3
1 1
0 0
GFortran 12 and ifort 2021 support hostassoc1.f90
, but do not support hostassoc2.f90
. For hostassoc2.f90
, GFortran 12 gives wrong running results, while ifort reports the semantic error.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorflang:irflang:openmp