[Bug middle-end/92120] New: OpenMP 5 – implicit mapping of this->member variable access – "this[:1]" shall be mapped
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 16 10:06:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92120
Bug ID: 92120
Summary: OpenMP 5 – implicit mapping of this->member variable
access – "this[:1]" shall be mapped
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Loosely related to PR 66053 which is about explicit mapping.
The original code boils down to:
this->j = this->i[1] + this->i[2]
This ends up in omp_notice_variable (via gimplify_var_or_parm_decl) as "this",
but it is – in line with OpenMP 4.5 – only mapped as:
map(alloc:MEM[(char *)this] [len: 0]) map(firstprivate:this [pointer assign,
bias: 0])
However, for OpenMP 5 – and to be usable – one also needs the actual data, i.e.
map(tofrom:this[:1]).
OpenMP 4.5, "2.15.5 Data-mapping Attribute Rules and Clauses":
"A variable that is of type reference to pointer is treated as if it had
appeared in a map clause as a1zero-length array section."
OpenMP 5.0: "If the target construct is within a class non-static member
function, and a variable is an accessible data member of the object for which
the non-static data member function is invoked, the variable is treated as if
the this[:1] expression had appeared in a map clause with a map-type of tofrom.
[…]"
#include <stdlib.h> // For abort.
class foo {
public:
int i[2], j;
void func() {
int k[2];
#pragma omp target
j = i[1]+i[2];
}
};
int bar(int x)
{
foo cl;
cl.i[1] = x;
cl.i[2] = 42;
cl.func();
return cl.j;
}
int main()
{
if (bar(3) != 45)
abort();
return 0;
}
More information about the Gcc-bugs
mailing list