[flang-commits] [flang] [flang][PFT-to-MLIR] Wrap unstructured Fortran constructs in scf.execute_region (PR #208635)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Fri Jul 10 10:47:07 PDT 2026
tblah wrote:
Codex found an issue here:
> branchesAreInternal checks only controlSuccessor, which
> stores only the first multiway-branch target. Computed GOTO or arithmetic IF with a later external
> target gets wrapped and produces an illegal cross-region branch. The exact-head reproducer fails FIR
> verification; disabling wrapping succeeds.
It produced this reproducer, which I have verified does successfully lower to HLFIR with the new option disabled but fails with it enabled (as default)
```
subroutine computed_goto_exit(n, selector, a)
integer :: n, selector, i
real :: a(n)
do i = 1, n
go to (10, 99), selector
10 a(i) = real(i)
end do
a(1) = -1.0
99 continue
end subroutine
subroutine arithmetic_if_exit(n, x, a)
integer :: n, i
real :: x, a(n)
do i = 1, n
if (x) 10, 10, 99
10 a(i) = real(i)
end do
a(1) = -1.0
99 continue
end subroutine
``ยง
https://github.com/llvm/llvm-project/pull/208635
More information about the flang-commits
mailing list