diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2020-05-29 14:21:03 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-06-04 18:56:37 +0200 |
commit | 2112d3242f413979931e371423dcead9d19440e7 (patch) | |
tree | 5334ccbc15566536c066344dc4d9e46aed0384a0 /libgomp | |
parent | 4662f7fe7863b19fcc20ba58c22880f8d6661f3a (diff) | |
download | gcc-2112d3242f413979931e371423dcead9d19440e7.zip gcc-2112d3242f413979931e371423dcead9d19440e7.tar.gz gcc-2112d3242f413979931e371423dcead9d19440e7.tar.bz2 |
[OpenACC] Don't open-code 'gomp_remove_var' in 'acc_unmap_data'
libgomp/
* oacc-mem.c (acc_unmap_data): Don't open-code 'gomp_remove_var'.
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/oacc-mem.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index 6314f5d..8e8c7c3 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -468,8 +468,6 @@ acc_unmap_data (void *h) (void *) h, (int) host_size); } - splay_tree_remove (&acc_dev->mem_map, n); - struct target_mem_desc *tgt = n->tgt; if (tgt->refcount == REFCOUNT_INFINITY) @@ -482,8 +480,12 @@ acc_unmap_data (void *h) 'acc_map_data'. */ assert (tgt->refcount == 1); - free (tgt->array); - free (tgt); + /* Nullifying these fields prevents 'gomp_unmap_tgt' via 'gomp_remove_var' + from freeing the target memory. */ + tgt->tgt_end = 0; + tgt->to_free = NULL; + + gomp_remove_var (acc_dev, n); gomp_mutex_unlock (&acc_dev->lock); |