[gcc r11-7111] openacc: Use class_pointer instead of pointer attribute for class types

Julian Brown jules@gcc.gnu.org
Thu Feb 4 23:17:08 GMT 2021


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

commit r11-7111-gf743fe231663e32d52db987650d0ec3381a777af
Author: Julian Brown <julian@codesourcery.com>
Date:   Fri Jan 29 17:18:07 2021 -0800

    openacc: Use class_pointer instead of pointer attribute for class types
    
    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.

Diff:
---
 gcc/fortran/trans-openmp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index a5fe0e76af2..249b3de2cfd 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -2997,7 +2997,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;


More information about the Gcc-cvs mailing list