https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113724
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- Debugging shows: In gimplify_adjust_omp_clauses (line numbers are off by 1 as I have a #pragma GCC optimize("O0") on top of the file): 13717 groups = omp_gather_mapping_groups (list_p); ... 13720 if (groups) 13721 { 13722 grpmap = omp_index_mapping_groups (groups); 13723 13724 omp_resolve_clause_dependencies (code, groups, grpmap); 13725 omp_build_struct_sibling_lists (code, ctx->region_type, groups, 13726 &grpmap, list_p); On the outermost side: (gdb) p debug(*list_p) num_teams(-2) thread_limit(0) (gdb) p debug(*list_p) map(tofrom:S1.b) map(tofrom:S1.a) map(tofrom:S1.p) map(tofrom:*S1.p [len: 400]) map(attach_detach:S1.p [bias: 0]) The latter goes into the 'if (groups)' and list_p after line 13726 is: (gdb) p debug(*list_p) map(struct:S1 [len: 3]) map(tofrom:S1.a) map(tofrom:S1.b) The later ICE / segfault is because 'map(struct' has len = 3 but only two map clauses follow. And the other question is: Why is 'S1.p' gone? * * * The 'struct' (GOMP_MAP_STRUCT) with initial length is created by omp_accumulate_sibling_list: 11120 OMP_CLAUSE_SET_MAP_KIND (l, str_kind); 11121 OMP_CLAUSE_DECL (l) = unshare_expr (base); 11122 OMP_CLAUSE_SIZE (l) = size_int (1); and later updated via 11462 OMP_CLAUSE_SIZE (*osc) 11463 = size_binop (PLUS_EXPR, OMP_CLAUSE_SIZE (*osc), size_one_node); 11464 11465 if (reprocessing_struct) * * * This works fine for: map(tofrom:S1.b) -> create struct with len=1 It works also for: map(tofrom:S1.a) -> update struct len to 2 + add 'S1.a' But not for: map(tofrom:S1.p) -> does update len to 3 but doesn't add 'S1.p'. I do note that at: 11382 if (attach_detach && sc == grp_start_p) (gdb) p attach_detach $139 = true (gdb) p sc == grp_start_p $140 = false (gdb) p debug(*sc) map(tofrom:S1.b) map(tofrom:S1.p) map(tofrom:*S1.p [len: 400]) map(attach_detach:S1.p [bias: 0]) (gdb) p debug(*grp_start_p) map(tofrom:*S1.p [len: 400]) map(attach_detach:S1.p [bias: 0])