Skip to content

[flang][openmp] Incorrect perfect nest detection if using continues instead of enddo. #161529

@scamp-nvidia

Description

@scamp-nvidia

Consider the following example, carved down from an OpenMP SPEC test:

! omp_compile_test.f90
program omp_compile_test
  implicit none
  integer, parameter :: N = 8
  real(8) :: PN(N,N) = 1.0d0, UN(N,N) = 2.0d0, VN(N,N) = 3.0d0
  real(8) :: P = 0.0d0, U = 0.0d0, V = 0.0d0
  integer :: i, j

!$omp target teams map(to:PN,UN,VN) map(tofrom:P,U,V)
!$omp loop collapse(2) reduction(+:P,U,V)
  do 4500 j = 1, N
    do 3500 i = 1, N
      P = P + abs(PN(i,j))
      U = U + abs(UN(i,j))
      V = V + abs(VN(i,j))
    3500 CONTINUE
   4500 CONTINUE
!$omp end target teams
end program

This has prevously worked, but began failing between d96c32c and fad2a4c with the following message:

scamp$ flang test.F90 -fopenmp -o test
error: Semantic errors in test.F90
./test.F90:10:7: error: Canonical loop nest must be perfectly nested.
  !$omp loop collapse(2) reduction(+:P,U,V)
        ^^^^

Reading the changes between those two hashes, I immediately key in on #160283 - which appears to work on perfectly nested OpenMP Flang structures. Tagging @Meinersbur for investigation, please.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions