]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[og10] openacc: Use class_pointer instead of pointer attribute for class types
authorJulian Brown <julian@codesourcery.com>
Sat, 30 Jan 2021 01:18:07 +0000 (17:18 -0800)
committerJulian Brown <julian@codesourcery.com>
Wed, 24 Feb 2021 14:31:59 +0000 (06:31 -0800)
Elsewhere in the Fortran front-end, the class_pointer attribute is
used for BT_CLASS entities instead of the pointer attribute. This patch
follows suit for OpenACC. I couldn't actually come up with a test case
where this makes a difference (i.e., where "class_pointer" and "pointer"
have different values at this point in the code), but this may nonetheless
fix a latent bug.

gcc/fortran/
* trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
for BT_CLASS.

(cherry picked from commit f743fe231663e32d52db987650d0ec3381a777af)

gcc/fortran/ChangeLog.omp
gcc/fortran/trans-openmp.c

index 9e0cf7198acf0a245cea3585f8e874485527fee9..2dd82a70cb7196009650ddd702d021f83bd82946 100644 (file)
@@ -1,3 +1,10 @@
+2021-02-24  Julian Brown  <julian@codesourcery.com>
+
+       Backport from mainline
+
+       * trans-openmp.c (gfc_trans_omp_clauses): Use class_pointer attribute
+       for BT_CLASS.
+
 2021-02-24  Julian Brown  <julian@codesourcery.com>
 
        Backport from mainline
index e53f7ebb7d7ff39e5f6cfcd3d5873d5b07973bf5..d0e299b02142fba42acf1a24ed2c6cff2e2bff68 100644 (file)
@@ -2973,7 +2973,10 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
                  if (lastcomp->u.c.component->ts.type == BT_DERIVED
                      || lastcomp->u.c.component->ts.type == BT_CLASS)
                    {
-                     if (sym_attr.pointer || (openacc && sym_attr.allocatable))
+                     bool pointer
+                       = (lastcomp->u.c.component->ts.type == BT_CLASS
+                          ? sym_attr.class_pointer : sym_attr.pointer);
+                     if (pointer || (openacc && sym_attr.allocatable))
                        {
                          tree data, size;