[flang-commits] [flang] [Flang][OpenMP] Support iterator modifier in map and motion clauses (PR #197757)

via flang-commits flang-commits at lists.llvm.org
Mon Jul 6 16:52:25 PDT 2026


================
@@ -43,6 +43,30 @@ func.func @test_descriptor_expansion_pass(%arg0: !fir.box<!fir.array<?xi32>>) {
 
 // -----
 
+func.func @test_iterator_descriptor_map_is_not_expanded(%arg0: !fir.box<!fir.array<?xf32>>) {
----------------
MattPD wrote:

The `isNestedInIterator` guard has no end-to-end test, though it prevents the descriptor-expansion crash. This test uses hand-written input IR, not IR generated by compiling Fortran. Its map shape uses `var_ptr` of `!fir.ref<!fir.array<...>>`. The frontend instead emits a scalar-element `var_ptr` on a `fir.box_addr` base, with result `!llvm.ptr`. I confirmed the frontend path does survive `MapInfoFinalization` without a crash. But no committed test drives Fortran through the pass. So a later frontend shape change could silently stop matching the guard while this `.fir` test still passes. Would a [`flang/test/Lower/OpenMP`](https://github.com/llvm/llvm-project/tree/f2cdab4c2e8bce895a78f9f00c27b902400c4923/flang/test/Lower/OpenMP) test be worth adding, one that compiles an allocatable or assumed-shape iterator map through finalization and CHECKs that the descriptor map is not expanded?

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


More information about the flang-commits mailing list