Closed as not planned
Closed as not planned
Description
Version of flang-new : 20.0.0(3496245ed3d0b4d24444260da77dcdb93512fb5a/AArch64
Variables defined with threadprivate
directive and explicit declaration
result in a compilation-time error.
When threadprivate
directive is removed, the compilation succeeds
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
$ flang-new -fopenmp snggy156_1.f90
error: Semantic errors in snggy156_.f90
./snggy156_.f90:6:11: error: The type of 'x1' has already been implicitly declared
integer x1
^^
./snggy156_.f90:3:11: Implicit declaration of 'x1'
save p1,x1
^^
./snggy156_.f90:7:27: error: The interface for procedure 'p1' has already been declared
procedure(ss1),pointer::p1
^^
./snggy156_.f90:3:8: Implicit declaration of 'p1'
save p1,x1
^^
$
$ gfortran -fopenmp snggy156_.f90; ./a.out
pass
$
$ ifort -qopenmp -diag-disable=10448 snggy156_.f90
snggy156_.f90(6): error #6415: This name cannot be assigned this data type because it conflicts with prior uses of the name.
[X1]
integer x1
----------^
snggy156_.f90(7): error #6406: Conflicting attributes or multiple declaration of name. [P1]
procedure(ss1),pointer::p1
--------------------------^
snggy156_.f90(16): error #6424: This name has already been used as an external subroutine name. [SS1]
p1=> ss1
----------^
snggy156_.f90(16): error #6796: The variable must have the TARGET attribute or be a subobject of an object with the TARGET at
tribute, or it must have the POINTER attribute. [SS1]
p1=> ss1
----------^
snggy156_.f90(18): error #6424: This name has already been used as an external subroutine name. [SS2]
p1=> ss2
----------^
snggy156_.f90(18): error #6796: The variable must have the TARGET attribute or be a subobject of an object with the TARGET at
tribute, or it must have the POINTER attribute. [SS2]
p1=> ss2
----------^
snggy156_.f90(20): error #6419: This scalar name is invalid in this context. [P1]
call p1(k)
-------^
compilation aborted for snggy156_.f90 (code 1)
$