On Tue, Sep 13, 2022 at 02:03:15PM -0700, Julian Brown wrote: > This patch moves GOMP_MAP_ATTACH{_ZERO_LENGTH_ARRAY_SECTION} nodes to > the end of the clause list, for offload regions. This ensures that when > we do the attach operation, both the "attachment point" and the target > region have both already been mapped on the target. This avoids a > pathological case that can otherwise happen with struct sibling-list > handling. > > 2022-09-13 Julian Brown <jul...@codesourcery.com> > > gcc/ > * gimplify.cc (omp_segregate_mapping_groups): Update comment. > (omp_push_attaches_to_end): New function. > (gimplify_scan_omp_clauses): Use omp_push_attaches_to_end for offloaded > regions.
Shouldn't this be done at the end of gimplify_adjust_omp_clauses? I mean, can't further attach clauses appear because of declare mapper for implicitly mapped variables? Other than that, it is yet another walk of the whole clause list, so would be nicer if it could be done in an existing walk over the clauses or at least have a flag whether there are any such clauses present and do it only in that case. If it could be done in the main gimplify_adjust_omp_clauses loop, nice, if it can appear also during splay_tree_foreach (ctx->variables, gimplify_adjust_omp_clauses_1, &data); that isn't the case. Jakub