On 09/10/2018 10:37 AM, Jason Merrill wrote: > On Mon, Sep 10, 2018 at 4:05 AM, Julian Brown <jul...@codesourcery.com> wrote: >> This patch (by Cesar) changes the way C++ references are mapped in >> OpenACC regions, fixing an ICE in the non-scalar-data.C testcase. >> >> Post-patch, references are mapped like this (from the omplower dump): >> >> map(force_present:*x [len: 4]) map(firstprivate ref:x [pointer assign, bias: >> 0]) >> >> Tested with offloading to NVPTX and bootstrapped. OK for trunk? >> >> Thanks, >> >> Julian >> >> ChangeLog >> >> 2018-09-09 Cesar Philippidis <ce...@codesourcery.com> >> Julian Brown <jul...@codesourcery.com> >> >> PR middle-end/86336 >> >> (gimplify_adjust_omp_clauses_1): Update handling of mapping of C++ >> references. > > How is reference handling specified differently between OpenMP and > OpenACC? It seems strange for them to differ.
Both OpenACC and OpenMP privatize mapped array pointers on the accelerator for subarrays in the same way. However, for pointers without subarrays, OpenMP treats them as zero-length arrays, whereas OpenACC treats them as ordinary scalars so that the pointer target will not get remapped on the accelerator (which is odd because there's a deviceptr clause for that). Scalars in C++ are special, because references must treated like an array of length one, for lack of a better terminology. > In any case, you shouldn't need to check lang_GNU_CXX since we're > already calling the langhook. Julian, can you look into this? I'm traveling tomorrow. Cesar