https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126279
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
BTW: It seems as if the generated code is nicer having:
static const struct omp_alloctrait_t traits1[1] = {{.key=2, .value=16}};
...
traits2.9 = (unsigned long) &traits2;
uses_allocator_descr.8[2] = traits2.9;
instead of
static struct omp_alloctrait t1[1] = {{.key=2, .value=128}};
...
D.4736[0].key = 2;
D.4736[0].value = 128;
...
D.4738 = (unsigned long) &D.4736;
uses_allocator_descr.5[2] = D.4738;
Namely:
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -14057,5 +14057,3 @@ lower_omp_target (gimple_stmt_iterator *gsi_p,
omp_context *ctx)
ntraits = array_type_nelts_top (TREE_TYPE (traits));
- tree t = DECL_INITIAL (traits);
- t = get_initialized_tmp_var (t, &ilist, NULL);
- traits_var = build_fold_addr_expr_loc (loc, t);
+ traits_var = build_fold_addr_expr_loc (loc, traits);
}
---------------------------------
On the Fortran side: Using the following works:
integer, pointer :: ip3(:)
...
c3 = omp_alloc (c_sizeof(x) * 3, my3)
...
call c_f_pointer(c3, ip3, shape=[3])
if (mod (TRANSFER (loc(ip3), iptr), 1024) /= 0) &
stop 1
Seems as if obtaining the pointee value for 'c3' is not that trivial.