Skip to content

[Flang][OpenMP]Variable used in TASK construct is not implicit firstprivate #64480

Closed
@ohno-fj

Description

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

Variable used in TASK construct is not implicit FIRSTPRIVATE.

According to the following specification, the variable(a) in the test program is FIRSTPRIVATE.

  • OpenMP Application Programming Interface Version 4.5 : subclause 2.15.1.1

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

omp3_task_024_2.f90:

program main
!$omp parallel
  call sub()
!$omp end parallel
  print *,"pass"
end program main

subroutine sub
  integer::a
  a=5
!$omp task
  write(6,*) "1  a = ", a
  if (a.eq.5) then
     a=a+10
  else
     print *,"NG-1:a=",a
  end if
  write(6,*) "2  a = ", a
!$omp end task
!$omp taskwait
  write(6,*) "3  a = ", a
  if (a.ne.5) then
     print *,"NG-2:a=",a
  end if
end subroutine sub
$ export OMP_NUM_THREADS=2; flang-new -fopenmp omp3_task_024_2.f90; ./a.out
 1  a =  5
 2  a =  15
 3  a =  15
 NG-2:a= 15
 1  a =  5
 2  a =  15
 3  a =  15
 NG-2:a= 15
 pass
$
$ export OMP_NUM_THREADS=2; gfortran -fopenmp omp3_task_024_2.f90; ./a.out
 1  a =            5
 2  a =           15
 3  a =            5
 1  a =            5
 2  a =           15
 3  a =            5
 pass
$
$ export OMP_NUM_THREADS=2; ifort -qopenmp omp3_task_024_2.f90; ./a.out
 1  a =            5
 2  a =           15
 3  a =            5
 1  a =            5
 2  a =           15
 3  a =            5
 pass
$

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions