-
Notifications
You must be signed in to change notification settings - Fork 11.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flang][OpenMP] Compilation error when declarations within threadprivate directive and explicit declarations #106021
Comments
@llvm/issue-subscribers-openmp Author: None (ohno-fj)
```
Version of flang-new : 20.0.0(3496245/AArch64
```
Variables defined with The following are the test program, Flang-new, Gfortran and ifort compilation/execution result. snggy156_.f90: subroutine s1
integer omp_get_thread_num
save p1,x1
!$omp threadprivate (p1)
!$omp threadprivate (x1)
integer x1
procedure(ss1),pointer::p1
interface
subroutine ss1(i)
end subroutine ss1
subroutine ss2(i)
end subroutine ss2
end interface
!$omp parallel private(k)
if (omp_get_thread_num() ==1) then
p1=> ss1
else
p1=> ss2
end if
call p1(k)
if (omp_get_thread_num() ==1) then
if (k/=1) print *,101
else
if (k/=2) print *,102
endif
!$omp end parallel
end subroutine s1
program main
call s1
print *,'pass'
end program main
subroutine ss1(i)
i=1
end subroutine ss1
subroutine ss2(i)
i=2
end subroutine ss2
|
@llvm/issue-subscribers-flang-frontend Author: None (ohno-fj)
```
Version of flang-new : 20.0.0(3496245/AArch64
```
Variables defined with The following are the test program, Flang-new, Gfortran and ifort compilation/execution result. snggy156_.f90: subroutine s1
integer omp_get_thread_num
save p1,x1
!$omp threadprivate (p1)
!$omp threadprivate (x1)
integer x1
procedure(ss1),pointer::p1
interface
subroutine ss1(i)
end subroutine ss1
subroutine ss2(i)
end subroutine ss2
end interface
!$omp parallel private(k)
if (omp_get_thread_num() ==1) then
p1=> ss1
else
p1=> ss2
end if
call p1(k)
if (omp_get_thread_num() ==1) then
if (k/=1) print *,101
else
if (k/=2) print *,102
endif
!$omp end parallel
end subroutine s1
program main
call s1
print *,'pass'
end program main
subroutine ss1(i)
i=1
end subroutine ss1
subroutine ss2(i)
i=2
end subroutine ss2
|
The problem is the declaration of a variable type after subroutine s1
save x1
!$omp threadprivate (x1)
integer x1
end subroutine Gfortran allows it, while ifort and ifx don't. I couldn't find anything in OpenMP standard that allows or disallows it. |
Variables defined with
threadprivate
directive andexplicit declaration
result in a compilation-time error.When
threadprivate
directive is removed, the compilation succeedsThe following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snggy156_.f90:
The text was updated successfully, but these errors were encountered: