On Mon, Sep 10, 2018 at 08:31:49PM -0400, Julian Brown wrote: > #pragma omp target enter data map(to:arr[0:32]) > > //#pragma omp target // works, mapped as zero-length array section (*) > //#pragma omp target map(tofrom:myptr) // crashes (**)
In this case OpenMP doesn't allow the implementation to choose what to do, it really should copy it bitwise in this case. There are cases where it will still work, e.g. if the pointer was in use_device_ptr clause on surrounding target data construct (doesn't even need to be visible to the compiler, could be in some non-visible caller), otherwise it would be a user bug. Warning might be useful, but only if we can prove the pointer value is really a host pointer, rather than use_device_ptr translated pointer or say something constructed out of CUDA or other APIs. > #pragma omp target map(tofrom:myptr[0:1]) // works > { > *myptr = 2000; > } > Jakub