llvm-project/flang/test/Lower/OpenMP/infinite-loop-in-construct.f90
Krzysztof Parzyszek 55cb52bbc5
[Flang][OpenMP] Restructure recursive lowering in createBodyOfOp (#77761)
This brings `createBodyOfOp` to its final intended form. First, input
privatization is performed, then the recursive lowering takes place, and
finally the output privatization (lastprivate) is done.

This enables fixing a known issue with infinite loops inside of an
OpenMP region, and the fix is included in this patch.

Fixes https://github.com/llvm/llvm-project/issues/74348.

Recursive lowering [5/5]

---------

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2024-01-22 08:41:07 -06:00

27 lines
693 B
Fortran

! RUN: bbc -fopenmp -o - %s | FileCheck %s
! Check that this test can be lowered successfully.
! See https://github.com/llvm/llvm-project/issues/74348
! CHECK-LABEL: func.func @_QPsb
! CHECK: omp.parallel
! CHECK: cf.cond_br %{{[0-9]+}}, ^bb1, ^bb2
! CHECK-NEXT: ^bb1: // pred: ^bb0
! CHECK: cf.br ^bb2
! CHECK-NEXT: ^bb2: // 3 preds: ^bb0, ^bb1, ^bb2
! CHECK-NEXT: cf.br ^bb2
! CHECK-NEXT: }
subroutine sb(ninter, numnod)
integer :: ninter, numnod
integer, dimension(:), allocatable :: indx_nm
!$omp parallel
if (ninter>0) then
allocate(indx_nm(numnod))
endif
220 continue
goto 220
!$omp end parallel
end subroutine