Minor change to previous patch – it did not affect the mainline build but it makes more sense this way and on OG12, i.e. with mapping allocatable components (patch posted last year in Q1 during Stage 4), it gave an ICE without this change as one '*' wasn't stripped. --- b/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -3439,5 +3439,5 @@ && n->sym->ts.deferred) { - if (!present && !DECL_P (decl)) + if (!DECL_P (decl)) { gcc_assert (TREE_CODE (decl) == INDIRECT_REF); Otherwise, the same written before applies, see below. (Side note: this patch has been committed to OG12 as http://gcc.gnu.org/g:55a18d47442 ) On 21.02.23 12:57, Tobias Burnus wrote: > This patch moves some generic code for Fortran out of gimplify.cc > to trans-openmp.cc and fixes several issues related to mapping. > > Tested with nvptx offloading. > OK for mainline? Tobias > Caveats: > > Besides the issues shown in the comment-out code, there remains also an > issue with implicit mapping - at least for deferred-length strings, > but I wouldn't be surprised if - at least depending on the used > 'defaultmap' value (e.g. 'alloc') - there are also issues with array > descriptors. > > Note: > > Regarding the declare target check for mapping: Without declare > target, my assumption is that the hidden length variable will > get implicitly mapped if needed. Independent of deferred-length > or not, there is probably an issue with 'defaultmap(none)' and > the hidden variable. - In any case, I prefer to defer all those > issues to later (by having them captured in one/several PR). > > > Tobias > > PS: This patch is a follow up to > [Patch] Fortran/OpenMP: Fix DT struct-component with 'alloc' and > array descr > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604887.html > which fixed part of the problems. But as discussed on IRC, it did > treat 'alloc' > as special and missed some other map types. - In addition, this patch > has a > much extended test coverage and fixes some more issues found that way. ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955