Open
Description
Version of flang : 21.0.0(8c7c791284877e36f73c41ffa56b52c13e613993)/AArch64
end single statement
with copyprivate clause
written in parallel construct
with private clause
in task construct
results in compilation errors.
The above program is sngtomp028_21.f90
.
When task construct
is removed, the compilation succeeds.
The above program is sngtomp028_22.f90
.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
sngtomp028_21.f90:
program main
real, dimension(:), allocatable :: a
real, dimension(:), pointer :: b
!$omp task
!$omp parallel private (a, b)
allocate (a(5))
allocate (b(10))
!$omp single
a = 22
b = 33
!$omp end single copyprivate (a, b)
if(any(a/=(/(22,j=1,5)/))) print *,'err1'
if(any(b/=(/(33,k=1,10)/))) print *,'err2'
!$omp end parallel
!$omp end task
print *,'pass'
end program main
$ flang -fopenmp sngtomp028_21.f90
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: Semantic errors in sngtomp028_21.f90
./sngtomp028_21.f90:11:31: error: COPYPRIVATE variable 'a' is not PRIVATE or THREADPRIVATE in outer context
!$omp end single copyprivate (a, b)
^
./sngtomp028_21.f90:11:34: error: COPYPRIVATE variable 'b' is not PRIVATE or THREADPRIVATE in outer context
!$omp end single copyprivate (a, b)
^
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sngtomp028_21.f90; ./a.out
pass
$
$ export OMP_NUM_THREADS=2; ifx -qopenmp sngtomp028_21.f90; ./a.out
pass
$
sngtomp028_22.f90:
program main
real, dimension(:), allocatable :: a
real, dimension(:), pointer :: b
! !$omp task
!$omp parallel private (a, b)
allocate (a(5))
allocate (b(10))
!$omp single
a = 22
b = 33
!$omp end single copyprivate (a, b)
if(any(a/=(/(22,j=1,5)/))) print *,'err1'
if(any(b/=(/(33,k=1,10)/))) print *,'err2'
!$omp end parallel
! !$omp end task
print *,'pass'
end program main
$ export OMP_NUM_THREADS=2; flang -fopenmp sngtomp028_21.f90; ./a.out
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
pass
$
Metadata
Metadata
Assignees
Type
Projects
Status
In Progress