Skip to content

[Flang][OpenMP]Incorrect execution result of COPYPRIVATE clause specified in SINGLE construct #63933

@ohno-fj

Description

@ohno-fj
Version of flang-new : 17.0.0(abe9ae6d414e2b729f320626245e03b8bbde6143)

COPYPRIVATE clause specified in SINGLE construct does not seem to be valid.
The results were the same with or without COPYPRIVATE.

The following are the test program, results of Flang-new, GFortran and ifort compilation and execution.

omp_fp16_sin_cp01_5.f90:

program main
  real(4),save::a
!$omp threadprivate(a)
!$omp parallel
!$omp single
  a=1.0
!$omp end single copyprivate(a)
  write(6,*) "a = ", a
  if (a /= 1.0) then
     write(6,*) "NG"
  endif
!$omp end parallel
  print *,'pass'
end program main
$ export OMP_NUM_THREADS=2; flang-new -fopenmp omp_fp16_sin_cp01_5.f90; ./a.out
 a =  1.
 a =  0.
 NG
 pass
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp omp_fp16_sin_cp01_5.f90; ./a.out
 a =    1.00000000
 a =    1.00000000
 pass
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp omp_fp16_sin_cp01_5.f90; ./a.out
 a =    1.000000
 a =    1.000000
 pass
$

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions