https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92028

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looking at that commit, what I've commited in target.c is certainly not what I
meant to commit, which was something like (untested):
--- libgomp/target.c.jj 2019-10-07 13:09:07.038253353 +0200
+++ libgomp/target.c    2019-10-08 15:19:16.249439849 +0200
@@ -593,6 +593,19 @@ gomp_map_vars_internal (struct gomp_devi
          tgt->list[i].key = NULL;
          if (!not_found_cnt)
            {
+             cur_node.host_start = (uintptr_t) hostaddrs[i];
+             cur_node.host_end = cur_node.host_start;
+             splay_tree_key n = gomp_map_lookup (mem_map, &cur_node);
+             if (n == NULL)
+               {
+                 gomp_mutex_unlock (&devicep->lock);
+                 gomp_fatal ("use_device_ptr pointer wasn't mapped");
+               }
+             cur_node.host_start -= n->host_start;
+             hostaddrs[i]
+               = (void *) (n->tgt->tgt_start + n->tgt_offset
+                           + cur_node.host_start);
+             tgt->list[i].offset = ~(uintptr_t) 0;
            }
          else
            tgt->list[i].offset = 0;

Essentially, if nothing is so far queued to be mapped, we can try to resolve
USE_DEVICE_PTR the way we did before, but if there is something queued, because
the middle-end for OpenMP 5.0 ensures that map clauses go before use_device_*
clauses, we need to wait and handle it only later.

Reply via email to