This patch (by Cesar) changes the way that mapping of firstprivate scalars works for OpenACC. For scalars whose type has a size equal to or smaller than the size of a pointer, rather than copying the value of the scalar to the target device and having a separate mapping for a pointer to the copied value, a single "pointer" is mapped whose bits are a type-punned representation of the value itself. This is a performance optimisation: the idea, IIUC, is that it is a good idea to avoid having all launched compute resources contend for a single memory location -- the pointed-to cell containing the scalar on the device, in this case. Cesar talks about speedups obtained here (for an earlier version of the patch): https://gcc.gnu.org/ml/gcc-patches/2017-01/msg02171.html The patch implies an API change for the libgomp plugin, in that it must now understand that NULL device pointers correspond to host pointers that are actually type-punned scalars. Tested with offloading to NVPTX and bootstrapped. OK for mainline? Julian ChangeLog 2018-09-20 Cesar Philippidis Julian Brown gcc/ * omp-low.c (maybe_lookup_field_in_outer_ctx): New function. (convert_to_firstprivate_int): New function. (convert_from_firstprivate_int): New function. (lower_omp_target): Enable GOMP_MAP_FIRSTPRIVATE_INT in OpenACC. libgomp/ * oacc-parallel.c (GOACC_parallel_keyed): Handle GOMP_MAP_FIRSTPRIVATE_INT host addresses. * plugin/plugin-nvptx.c (nvptx_exec): Handle GOMP_MAP_FIRSTPRIVATE_INT host addresses. * testsuite/libgomp.oacc-c++/firstprivate-int.C: New test. * testsuite/libgomp.oacc-c-c++-common/firstprivate-int.c: New test. * testsuite/libgomp.oacc-fortran/firstprivate-int.f90: New test.