https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121639
Bug ID: 121639 Summary: [OpenMP] ICE when trying to map a member variable of reference type Product: gcc Version: 16.0 Status: UNCONFIRMED Keywords: ice-on-valid-code, openmp Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: tschwinge at gcc dot gnu.org Target Milestone: --- Reference members should automatically get mapped alongside mapping the struct/class itself. The ICE shows up in gcc/tree.cc:15210's verify_type_context (loc=75530114, context=TCTX_OMP_MAP, type=0x0, silent_p=false) 15210 gcc_assert (TYPE_P (type)); (gdb) p type $1 = (const_tree) 0x0 ---------------------------- #include <stdio.h> int x; struct s { int &xr = x; void f() { // #pragma omp target map(xr) // -> ICE (1) // #pragma omp target map(this->xr) // -> ICE (2) // #pragma omp target map(this[:1]) // -> ICE (4) #pragma omp target // -> ICE (3) __builtin_printf("%pp\n", &xr); } }; int main() { struct s x; x.f(); } ---------------------------- #0 verify_type_context (loc=75530114, context=TCTX_OMP_MAP, type=0x0, silent_p=false) at gcc/tree.cc:15210 #1 0x00000000011e91d6 in gimplify_scan_omp_clauses (list_p=0x7ffff705c060, list_p@entry=0x7ffff7058ac0, pre_p=pre_p@entry=0x7fffffffc780, region_type=region_type@entry=ORT_TARGET, code=<optimized out>, loops_seq_p=loops_seq_p@entry=0x7fffffffc540) at gcc/tree.h:3880 #2 0x00000000012145da in gimplify_omp_workshare (expr_p=expr_p@entry=0x7ffff722bcb0, pre_p=pre_p@entry=0x7fffffffc780) at gcc/gimplify.cc:18734 #3 0x00000000011ef5cb in gimplify_expr (expr_p=0x7ffff722bcb0, pre_p=pre_p@entry=0x7fffffffc780, post_p=0x7fffffffc5f0, post_p@entry=0x0, gimple_test_f=gimple_test_f@entry=0x11d9520 <is_gimple_stmt(tree)>, fallback=fallback@entry=0)