Skip to content

[flang][openmp] Bad code for index variable used in "shared" clause #102961

@psteinfeld

Description

@psteinfeld

Here's a reproducer:

program bug
  implicit none
  integer :: i, j
  i = 0
  j = 0
  !$omp parallel shared(i)
    !$omp sections
      do i=1,10
        j = j + i
      end do
    !$omp end sections
  !$omp end parallel
  print *, "i: ", i
  if ( i==11 ) then
    print *,'ok'
  else
    print *,'fail, i: ', i
  end if
end program

When I compile this program with the -fopenmp option and execute it, I get the output:

 i:  0
 fail, i:  0

When similarly compiled with gfortran and executed, I get:

 ok

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions