[Openmp-commits] [flang] [mlir] [openmp] [Flang][OpenMP] Add support for interop construct (PR #203959)
Sairudra More via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jul 3 00:03:56 PDT 2026
================
@@ -5872,7 +5872,12 @@ void OmpStructureChecker::Enter(const parser::OpenMPInteropConstruct &x) {
context_.Say(GetContext().directiveSource,
"Each interop-type may be specified at most once."_err_en_US);
}
- if (isDependClauseOccurred && !targetSyncCount) {
+ // Only enforce the depend/targetsync constraint when an init clause is
+ // present on this directive. For use/destroy-only directives, the interop
+ // object's type was established at its init site, which may be in a
+ // different statement — we cannot verify it statically here.
+ bool hasInitClause = (targetCount > 0 || targetSyncCount > 0);
----------------
Saieiei wrote:
I think this should track whether an `init` action clause is actually present, rather than using `targetCount || targetSyncCount` as a proxy.
At OpenMP 6.0, an untyped init clause is accepted:
```fortran
integer(omp_interop_kind) :: obj
integer :: x
!$omp interop init(obj) depend(inout: x)
```
With this change, both counts are zero, so `hasInitClause` becomes false and the `depend`/`targetsync` diagnostic is skipped. The typed control case still diagnoses correctly:
```fortran
!$omp interop init(target: obj) depend(inout: x)
```
https://github.com/llvm/llvm-project/pull/203959
More information about the Openmp-commits
mailing list