Skip to content

Issue in OMP min reduction with nested Parallel Do and Private Variables. #76778

Closed
@harishch4

Description

@harishch4

Are OMP min reductions supported currently in llvm-flang?

The below program works fine with gfortran but fails with llvm-flang.

program min_reduction
   implicit none
   integer, parameter :: n = 1024
   integer :: a(n, n), v, i, j, x, y
   do i = 1, n
      do j = 1, n
         a(i, j) = i + j ! min = 2; max = 2048
      end do
   end do
   v = a(1, 1)
   y = -2
   !$omp parallel do private(x) reduction(min: v)
   do i = 1, n
      do j = 1, n
         x = (i + j)*y ! min = 2048*-2 = -4096
         v = min(v, a(i, j), x)
      end do
   end do
   !$omp end parallel do
!    print *, "min(a) = ", v
   if (v == 2*n*y) then
      print *, "PASS"
   else
      print *, "FAIL"
   end if
end program

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorflang:irflang:openmp

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions