[Mlir-commits] [flang] [mlir] [mlir][flang][OpenMP] Select iterators per locator and allow multi-block regions (PR #227454)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Oct 11 20:06:29 PDT 2026
================
@@ -6101,6 +6119,42 @@ void OmpStructureChecker::CheckArraySection(
}
}
+// OpenMP 5.2 3.2.5 forbids explicit strides unless the clause permits them.
+// Check only the locator's base chain, not sections in subscript expressions.
+void OmpStructureChecker::CheckArraySectionStrides(
+ const parser::DataRef &dataRef, llvm::omp::Clause clause) {
+ common::visit(
+ common::visitors{
+ [](const parser::Name &) {},
+ [&](const common::Indirection<parser::StructureComponent> &x) {
+ CheckArraySectionStrides(x.value().Base(), clause);
+ },
+ [&](const common::Indirection<parser::ArrayElement> &x) {
+ const auto &arrayElement{x.value()};
+ const auto &name{GetLastName(arrayElement.Base())};
+ // Scalar character substrings can be parsed as ArrayElement.
+ if (name.symbol->Rank() > 0 &&
----------------
MattPD wrote:
An unresolved earlier component leaves `name.symbol` null, so the new walk crashes before Flang emits the component diagnostic:
```fortran
subroutine s(a)
type t
integer :: f
end type
type(t) :: a
!$omp task depend(in: a%missing(::2)%f)
!$omp end task
end
```
At the reviewed commit, `flang -fsyntax-only -fopenmp -fopenmp-version=52 repro.f90` exits 254. At the [parent commit](https://github.com/llvm/llvm-project/commit/5655cabbd7b780c9b3bcfbbb07a619139990f06c), it exits 1 with `Component 'missing' not found in derived type 't'`. AFFINITY and the unstrided `a%missing(:)%f` form have the same regression. Could this walk preserve that diagnostic? Could you also add recovery tests for both clauses?
https://github.com/llvm/llvm-project/pull/227454
More information about the Mlir-commits
mailing list