[Mlir-commits] [flang] [llvm] [mlir] [flang][mlir][OpenMP] Support iterator modifier in declare mapper map clause (PR #215485)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 23 00:14:57 PDT 2026


================
@@ -2035,13 +2079,144 @@ bool ClauseProcessor::processMap(
       }
     }
 
-    if (iterator)
-      TODO(currentLocation,
-           "Support for iterator modifiers is not implemented yet");
     TodoLocators(currentLocation, objects);
----------------
MattPD wrote:

With this PR, Flang crashes when a program unit uses a module defining an iterator mapper, even if the unit never references the mapper.

Save this module as `mod.f90`:

```fortran
module iter_mapper_mod
  type :: t
    integer :: a(3)
  end type
  !$omp declare mapper(m: t :: v) map(iterator(i=1:3): v%a(i))
end module
```

Save this program as `use.f90`:

```fortran
program import_only
  use iter_mapper_mod
  type(t) :: x
  x%a = 0
end program
```

Run `flang -fc1 -fsyntax-only -fopenmp -fopenmp-version=52 mod.f90`, then run `flang -fc1 -emit-hlfir -fopenmp -fopenmp-version=52 use.f90 -o -` in the same directory. The second command ends with a segmentation fault in `TodoLocators` (`ClauseProcessor.cpp:41`), reached from `materializeOpenMPDeclareMappers`.

The `TodoLocators` crash predates this PR: Without this PR, Flang crashes the same way on an imported mapper with `map(v%a(1))`. For an imported iterator mapper, though, Flang without this PR stops earlier with `not yet implemented: Support for iterator modifiers is not implemented yet` and never reaches `TodoLocators`.

Could Flang keep emitting a not-yet-implemented diagnostic for imported mappers with an iterator modifier until it supports imported subscripted locators?

https://github.com/llvm/llvm-project/pull/215485


More information about the Mlir-commits mailing list