[flang-commits] [flang] [flang][HLFIR] Fix crash in WHERE with exactly_once inside elemental (PR #194443)
Michael Klemm via flang-commits
flang-commits at lists.llvm.org
Tue Apr 28 03:23:45 PDT 2026
mjklemm wrote:
> It should be `return builder.getRegion().getParentOfType<hlfir::WhereOp>();`.
>
> Then it is impossible for an hlfir.exactly_once to be nested inside an hlfir.elemental before the parent hlfir.where.
With this, it seems that the problem is shifting and the original Fortran code now gives an error along these lines:
```
loc("XXXX":xx:y): error: failed to
legalize operation 'hlfir.exactly_once': %49 = "hlfir.exactly_once"() ({...}) : () ->
!hlfir.expr<?x!fir.logical<4>>
error: failure in HLFIR bufferization pass
error: Lowering to LLVM IR failed
loc("XXXX":zz:a): error: cannot be
converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func
error: failed to create the LLVM module
```
It seems that even though the update condition is supposed to avoid the nesting, later code-gen still trips over it.
https://github.com/llvm/llvm-project/pull/194443
More information about the flang-commits
mailing list