public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-11] Structure element mapping for OpenMP 5.0 v3
Date: Mon, 31 May 2021 13:51:16 +0000 (GMT)	[thread overview]
Message-ID: <20210531135116.4412E3857403@sourceware.org> (raw)

https://gcc.gnu.org/g:e7073707bab79ceceaa0e2d25a632d03ac98d0fd

commit e7073707bab79ceceaa0e2d25a632d03ac98d0fd
Author: Chung-Lin Tang <cltang@codesourcery.com>
Date:   Mon May 31 21:45:50 2021 +0800

    Structure element mapping for OpenMP 5.0 v3
    
    This is a merge of patch:
    https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571515.html
    
    v2 patch already merged at 18dd4f283e15894a26c9a105c4f87d9a585f93c5,
    this commit only consists of the v2-to-v3 diff part in above URL.
    
    This v3 adds a small bug fix, where the initialization of the refcount didn't
    handle all cases, fixed by using gomp_refcount_increment here (more consistent).
    
    libgomp/ChangeLog:
    
            * target.c (gomp_map_vars_internal): For new key entries, set
            k->refcount to 0, remove initialization of k->structelem_refcount,
            use gomp_increment_refcount to consistently handle all increment cases.

Diff:
---
 libgomp/target.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libgomp/target.c b/libgomp/target.c
index d373fed8956..f0a66fc83c3 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1559,7 +1559,7 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
 		size_t align = (size_t) 1 << (kind >> rshift);
 		tgt->list[i].key = k;
 		k->tgt = tgt;
-		k->refcount = 1;
+		k->refcount = 0;
 		k->dynamic_refcount = 0;
 		if (field_tgt_clear != FIELD_TGT_EMPTY)
 		  {
@@ -1572,7 +1572,6 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
 			  {
 			    /* Set to first structure element of sequence.  */
 			    k->refcount |= REFCOUNT_STRUCTELEM_FLAG_FIRST;
-			    k->structelem_refcount = 1;
 			    field_tgt_structelem_first = k;
 			  }
 			else
@@ -1596,6 +1595,11 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
 		    k->tgt_offset = tgt_size;
 		    tgt_size += k->host_end - k->host_start;
 		  }
+		/* First increment, from 0 to 1. gomp_increment_refcount
+		   encapsulates the different increment cases, so use this
+		   instead of directly setting 1 during initialization.  */
+		gomp_increment_refcount (k, refcount_set);
+
 		tgt->list[i].copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
 		tgt->list[i].always_copy_from
 		  = GOMP_MAP_ALWAYS_FROM_P (kind & typemask);


                 reply	other threads:[~2021-05-31 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210531135116.4412E3857403@sourceware.org \
    --to=cltang@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).