public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] Ensure sender/receiver refs are in the correct address space
@ 2021-05-13 16:15 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2021-05-13 16:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5e771bbf629988d0711c0d1e114bef0e1d238580

commit 5e771bbf629988d0711c0d1e114bef0e1d238580
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Sat Jun 6 08:02:00 2020 -0700

    Ensure sender/receiver refs are in the correct address space
    
    This fixes ICEs that may occur when the sender or receiver is in a different
    address space.
    
    2020-06-06  Kwok Cheung Yeung  <kcy@codesourcery.com>
    
            gcc/
            * omp-sese.c (oacc_build_component_ref): Apply address space of
            base object to the entire component reference.

Diff:
---
 gcc/ChangeLog.omp | 5 +++++
 gcc/omp-sese.c    | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 632e8000b10..d1b0640c9ea 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-06-06  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* omp-sese.c (oacc_build_component_ref): Apply address space of
+	base object to the entire component reference.
+
 2020-03-27  Sandra Loosemore  <sandra@codesourcery.com>
 
 	* doc/invoke.texi (Option Summary): Add entries for
diff --git a/gcc/omp-sese.c b/gcc/omp-sese.c
index 8138de8eef4..c5d87ab729a 100644
--- a/gcc/omp-sese.c
+++ b/gcc/omp-sese.c
@@ -936,7 +936,14 @@ worker_single_simple (basic_block from, basic_block to,
 static tree
 oacc_build_component_ref (tree obj, tree field)
 {
-  tree ret = build3 (COMPONENT_REF, TREE_TYPE (field), obj, field, NULL);
+  tree field_type = TREE_TYPE (field);
+  tree obj_type = TREE_TYPE (obj);
+  if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (obj_type)))
+    field_type = build_qualified_type
+			(field_type,
+			 KEEP_QUAL_ADDR_SPACE (TYPE_QUALS (obj_type)));
+
+  tree ret = build3 (COMPONENT_REF, field_type, obj, field, NULL);
   if (TREE_THIS_VOLATILE (field))
     TREE_THIS_VOLATILE (ret) |= 1;
   if (TREE_READONLY (field))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-13 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 16:15 [gcc/devel/omp/gcc-11] Ensure sender/receiver refs are in the correct address space Kwok Yeung

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).