Skip to content

[Flang][OpenMP]Incorrect execution result when reduction-identifier(+) is used in REDUCTION clause #71370

@ohno-fj

Description

@ohno-fj
Version of flang-new : 18.0.0(1c876ff5155c4feeb2b2885eb3e6abda17c4b7f4)

Using reduction-identifier(+) in REDUCTION clause results in incorrect execution.
The program is executed on 1 thread and expects a value of 11 for a.

The following are the test program, Flang-new, Gfortran and ifort compilation result.

ompds111_2.f90:

program main
  integer :: a
  call OMP_SET_NUM_THREADS(1)
  a=1
!$omp parallel reduction(+:a)
  a=10
!$omp end parallel
  print *,a
end program main
$ flang-new ompds111_2.f90 -fopenmp; ./a.out
 10
$
$ gfortran ompds111_2.f90 -fopenmp; ./a.out
          11
$
$ ifort ompds111_2.f90 -qopenmp; ./a.out
          11
$

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions