[Bug fortran/104696] [OpenMP] Implicit mapping breaks struct mapping
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 10 15:13:18 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104696
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Chung-Lin Tang from comment #3)
> The problem, at a low-level, is that the Fortran FE is using always_pointer,
> while C/C++ front-ends generate attach_detach (and turns in attach after
> gimplify).
Actually, if one modifies the C testcase, as alluded in previous comment 2, one
runs into the same issue. Namely, for:
------------ test.c--------------
struct s { int d; };
struct s2 { struct s r[5], q, arr[1024][1024]; };
int main () {
struct s2 x;
#pragma omp target map(tofrom: x.q.d)
x.q.d = 2;
#pragma omp target map(tofrom: x.r[1].d)
*.r[1].d = 3;
__builtin_printf("%d, %d\n", x.q.d, x.r[1].d);
return 0;
}
------------ test.c--------------
The expect result is 'struct: x' + 'tofrom: x.r[1].d' - and as 'struct:x'
exists, no implicit mapping of 'x' happens.
That happens for 'x.q.d':
map(struct:x [len: 1]) map(tofrom:x.q.d [len: 4])
but not for 'x.r[1].d':
map(tofrom:x [len: 4194328][implicit]) map(tofrom:x.r[1].d [len: 4])
Thus the code which constructs 'struct: x' has trouble for 'component ref +
array ref + component ref'.
More information about the Gcc-bugs
mailing list