On Mon, Jul 27, 2015 at 07:33:59AM -0400, Nathan Sidwell wrote: > On 07/27/15 04:23, Jakub Jelinek wrote: > >On Sun, Jul 26, 2015 at 11:01:09AM -0400, Nathan Sidwell wrote: > >>I found some more missing consts. The size, kind, var and function arrays > >>emitted by omp-low are read only, but are not so marked. This patch > > > >First of all, the hostaddrs array is going to be written by the library > >side for GOMP_MAP_FIRSTPRIVATE, so can't be const and shouldn't be const on > >the compiler emitted side either. Similarly for the use_device_ptr clause > >on GOMP_target_data* handling. > >The size array is const from the library side, sure, but on the compiler > >side is only conditionally static (static only if all the values written to > >it are INTEGER_CSTs), so not sure if we want to make it use const qualified > >type unconditionally, rather than only change it to the const qualified type > >if it is TREE_STATIC at the end. > >The kinds array I'm afraid might very well soon follow the size array model. > > Ok, thanks for the explanation. I'm puzzled though about writing the sizes > and kinds arrays. They're global object, so that doesn't seem thread-safe? > Or is it ill-formed to have multiple host threads execute the same > potentially offloaded function concurrently?
They are only global objects if they are filled with constants. Right know for kinds array that is true always, for sizes array if no VLAs nor variable length array sections are used. They are initially TREE_STATIC (var) = 1; but we later on clear it with TREE_STATIC (var) = 0; if it is constant (this is still before the decls are finalized). Jakub