]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Ensure sender/receiver refs are in the correct address space
authorKwok Cheung Yeung <kcy@codesourcery.com>
Sat, 6 Jun 2020 15:02:00 +0000 (08:02 -0700)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 9 Jun 2020 22:32:21 +0000 (15:32 -0700)
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.

gcc/ChangeLog.omp
gcc/omp-sese.c

index 6c76ccf6228b51b42166ad92015b811631d97cf8..5cab5e10b39601bbf91586918939ba4535d75212 100644 (file)
@@ -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
index 620ca8985ff70011f669da4e4abf8f616dc4b9cf..a64c9c3146a2045bb9fcd0496c6238ff4edf3e76 100644 (file)
@@ -937,7 +937,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))