[flang-commits] [flang] [flang][OpenMP] Fix copyprivate semantic checks (PR #95799)

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Wed Jul 24 13:16:17 PDT 2024


psteinfeld wrote:

@luporl, after this change, I'm seeing errors in our internal test suites.  Here's a program that produces similar errors:
```
[pete at rome3 install]$cat bug.f90
program bug
  use omp_lib
  implicit none
  integer i1,i2,i3,m
  type derived
    integer field(2,3)
  end type
  type(derived) y(5)
  integer,parameter :: nt = 2
  integer field(nt)
  field = 0
  m = 1
  !$OMP PARALLEL DO NUM_THREADS(nt) PRIVATE(m) DEFAULT(NONE) SHARED(y,field) &
  !$OMP COLLAPSE(2) SCHEDULE(STATIC)
  do i1=1,size(y,1)
    do i3=1,3
      do i2=1,2
        y(i1)%field(i2,i3) = 1
        !$omp atomic
        field(m) = field(m) + 1 !error here
      end do
    end do
  end do
  !$OMP END PARALLEL DO
end program

flang-new -fopenmp -fopenmp-version=31 bug.f90 
error: Semantic errors in bug.f90
./bug.f90:20:9: error: Reference to rank-2 object 'field' has 1 subscripts
          field(m) = field(m) + 1 !error here
          ^^^^^^^^
./bug.f90:20:20: error: Reference to rank-2 object 'field' has 1 subscripts
          field(m) = field(m) + 1 !error here
                     ^^^^^^^^
```

Before you merged this change, this program compiled cleanly.  Can you please either revert or fix this?

https://github.com/llvm/llvm-project/pull/95799


More information about the flang-commits mailing list