Skip to content

[flang][OpenMP] Lowering of OpenMP construct fails in a procedure with alternate entries #139071

Open
@eugeneepshteyn

Description

@eugeneepshteyn

Reproducer:

  subroutine process_a(n, a)
    integer, intent(in) :: n
    real, intent(inout) :: a(n)
    integer :: i

    !$omp parallel do
    do i = 1, n
      a(i) = a(i) * 2.0
    end do
    !$omp end parallel do

    return

    entry process_b(n, b)
      
      !$omp parallel do
      do i = 1, n
        a(i) = i * i
      end do
      !$omp end parallel do

  end subroutine process_a

Failure:

$ flang -c -fopenmp omp-entry.f90 
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: loc("/home/eepshteyn/tmp/omp-entry.f90":22:3): operation with block successors must terminate its parent block
error: verification of lowering to FIR failed

$ flang --version
flang version 21.0.0git (https://github.com/eugeneepshteyn/llvm-project.git 4eebc8d003f25adf52a75702d6ee24f69330d920)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Build config: +unoptimized, +assertions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions