From: Thomas Schwinge Date: Fri, 29 May 2020 12:12:16 +0000 (+0200) Subject: [OpenACC] Remove 'tgt' reference counting from 'acc_unmap_data' [PR92854] X-Git-Tag: releases/gcc-10.2.0~278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c59837c89bd62e2addf4b34704a1ebe7e3bffab;p=thirdparty%2Fgcc.git [OpenACC] Remove 'tgt' reference counting from 'acc_unmap_data' [PR92854] libgomp/ PR libgomp/92854 * oacc-mem.c (acc_unmap_data): Remove 'tgt' reference counting. (cherry picked from commit 4662f7fe7863b19fcc20ba58c22880f8d6661f3a) --- diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index e2fb651a2334..6314f5d8b686 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -477,13 +477,13 @@ acc_unmap_data (void *h) gomp_mutex_unlock (&acc_dev->lock); gomp_fatal ("cannot unmap target block"); } - else if (tgt->refcount > 1) - tgt->refcount--; - else - { - free (tgt->array); - free (tgt); - } + + /* Above, we've verified that the mapping must have been set up by + 'acc_map_data'. */ + assert (tgt->refcount == 1); + + free (tgt->array); + free (tgt); gomp_mutex_unlock (&acc_dev->lock);