I've taken over this patch set from its original author Kwok Cheung Yeung (who is now doing other things). The last version (v5) was posted here:
https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689053.html First, an update on where we are. Parts 1-3 of the 11-part v5 series have already been approved and were committed last July. The current version v6 addresses review comments on the remaining parts, as well as rebasing the patches and fixing a few other things that bothered me as I've been working on them. I've retained the numbering of the previous patch set to avoid confusion, so the first part of the v6 series is part 4. Here's a summary of the status/changes of the remaining parts. Part 4, "openmp, fortran: Add support for map iterators in OpenMP target construct (Fortran)" was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/695040.html - Comment issue fixed. - The contains_vars stuff has been removed as useless. - Minor code tweak in target.c. - openmp_vv testcase test_target_map_iterators.c now passes in baseline results, so nothing to do there. Part 5, "openmp, fortran: Add support for iterators in OpenMP 'target update' constructs (Fortran)", was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/695078.html - I have fixed the comma parsing issue by requiring the comma (OpenMP 5.2 syntax). We've moved to deprecating pre-5.2 features/syntax elsewhere so not much point in implementing it only to deprecate it. - "LGTM with the parsing part being addressed." Part 6, "openmp: Add support for non-constant iterator parameters in map, to and from clauses", was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/695447.html - The ICE was already fixed by commit gcc-16-8237-gb0f6ab7f601 (it actually has nothing to do with this patch). - The requested comment has been added. - Several additional test cases have been added. - "LGTM" otherwise? Part 7, "openmp: Add macros for iterator element access" was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/695075.html - It was approved as-is, but I wasn't happy with it: the data structure describes a single iterator, so using the plural "OMP_ITERATORS_*" prefix was highly confusing. I also added some constructors and tweaked copy_omp_iterator to hide the magic numbers for the size of the underlying vector. Part 8, "openmp: Fix struct handling for OpenMP iterators" was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/696169.html - "I think this patch badly needs a testcase.... Otherwise, LGTM." - As suggested, I've added the new testcase (iterator-with-structs.c) to part 9 instead. Part 9, "openmp: Add support for using custom mappers with iterators (C, C++)" was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/695449.html - "LGTM." Part 10, "openmp, fortran: Add iterator support for Fortran, deep-mapping of allocatables" was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2026-April/712820.html - I've addressed the minor nits (additional comments, cleaner interface to assign_to_iterator_elems_array). - However, the request to add better testcases revealed that the patch is generating obviously broken code; it's inserting the mapping code in the wrong place/order, so it SEGVs right away at runtime due to an uninitialized variable. - I do not have a fix yet, and Tobias suggests I should focus on getting the previous patches in the series accepted before spending more time on this. - I'm posting the WIP patch anyway for the archives, in case I get run over by a bus before I finish it. Part 11, "openmp, fortran: Add support for non-constant iterator bounds in Fortran deep-mapping iterator support" was reviewed here: https://gcc.gnu.org/pipermail/gcc-patches/2025-September/696170.html - "LGTM" -- but it's blocked on part 10. - Likewise I'm posting the current version for the archives anyway. As far as testing goes, this version has been tested on x86_64-linux-gnu native without offloading (each patch individually in sequence), and as a group of the whole set and also through part 9 only on x86_64 host with both nvptx and amdgcn offloading. (During development I was also testing each patch individually with nvptx offloading.) These patches don't have a direct dependency on the two "obvious" patches I posted earlier today here https://gcc.gnu.org/pipermail/gcc-patches/2026-June/719414.html but will get a bunch of test failures without them. -Sandra Kwok Cheung Yeung (8): openmp, fortran: Add support for map iterators in OpenMP target construct (Fortran) openmp, fortran: Add support for iterators in OpenMP 'target update' constructs (Fortran) openmp: Add support for non-constant iterator parameters in map, to and from clauses openmp: Add macros for iterator element access openmp: Fix struct handling for OpenMP iterators openmp: Add support for using custom mappers with iterators (C, C++) openmp, fortran: Add iterator support for Fortran deep-mapping of allocatables openmp, fortran: Add support for non-constant iterator bounds in Fortran deep-mapping iterator support gcc/c-family/c-omp.cc | 2 + gcc/c/c-parser.cc | 22 +- gcc/c/c-typeck.cc | 24 +- gcc/cp/parser.cc | 22 +- gcc/cp/semantics.cc | 26 +- gcc/fortran/dump-parse-tree.cc | 14 +- gcc/fortran/match.cc | 4 +- gcc/fortran/openmp.cc | 111 +++++- gcc/fortran/trans-openmp.cc | 292 ++++++++++---- gcc/fortran/trans.h | 7 +- gcc/gimplify.cc | 363 +++++++++++++----- gcc/gimplify.h | 9 +- gcc/langhooks-def.h | 7 +- gcc/langhooks.cc | 6 +- gcc/langhooks.h | 22 +- gcc/omp-low.cc | 102 +++-- .../gomp/target-map-iterators-3.c | 8 +- .../gomp/target-map-iterators-5.c | 14 + .../gomp/target-update-iterators-3.c | 4 +- .../gomp/target-map-iterators-1.f90 | 26 ++ .../gomp/target-map-iterators-2.f90 | 30 ++ .../gomp/target-map-iterators-3.f90 | 24 ++ .../gomp/target-map-iterators-4.f90 | 28 ++ .../gomp/target-map-iterators-5.f90 | 21 + .../gomp/target-map-iterators-6.f90 | 26 ++ .../gomp/target-update-iterators-1.f90 | 33 ++ .../gomp/target-update-iterators-2.f90 | 25 ++ .../gomp/target-update-iterators-3.f90 | 23 ++ gcc/tree-inline.cc | 4 +- gcc/tree-pretty-print.cc | 26 +- gcc/tree.h | 32 ++ libgomp/target.c | 82 ++-- .../iterator-with-structs.c | 24 ++ .../libgomp.c-c++-common/mapper-iterators-1.c | 83 ++++ .../libgomp.c-c++-common/mapper-iterators-2.c | 81 ++++ .../target-map-iterators-1c.c | 58 +++ .../target-map-iterators-1d.c | 69 ++++ .../target-map-iterators-1e.c | 66 ++++ .../target-map-iterators-1f.c | 71 ++++ .../target-map-iterators-4.c | 48 +++ .../target-map-iterators-5.c | 59 +++ .../target-update-iterators-4.c | 66 ++++ .../allocatable-comp-iterators.f90 | 61 +++ .../target-map-iterators-1.f90 | 45 +++ .../target-map-iterators-1c.f90 | 58 +++ .../target-map-iterators-2.f90 | 45 +++ .../target-map-iterators-3.f90 | 50 +++ .../target-map-iterators-4.f90 | 48 +++ .../target-map-iterators-5.f90 | 55 +++ .../target-update-iterators-1.f90 | 68 ++++ .../target-update-iterators-2.f90 | 63 +++ .../target-update-iterators-3.f90 | 78 ++++ .../target-update-iterators-4.f90 | 70 ++++ 53 files changed, 2386 insertions(+), 319 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/target-map-iterators-5.c create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-map-iterators-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-map-iterators-2.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-map-iterators-3.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-map-iterators-4.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-map-iterators-5.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-map-iterators-6.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-update-iterators-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-update-iterators-2.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/target-update-iterators-3.f90 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/iterator-with-structs.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/mapper-iterators-1.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/mapper-iterators-2.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-map-iterators-1c.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-map-iterators-1d.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-map-iterators-1e.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-map-iterators-1f.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-map-iterators-4.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-map-iterators-5.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-update-iterators-4.c create mode 100644 libgomp/testsuite/libgomp.fortran/allocatable-comp-iterators.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-map-iterators-1.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-map-iterators-1c.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-map-iterators-2.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-map-iterators-3.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-map-iterators-4.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-map-iterators-5.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-update-iterators-1.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-update-iterators-2.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-update-iterators-3.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/target-update-iterators-4.f90 -- 2.39.5
