[gcc/devel/coarray_native] Check for correct type of ref before trying to handle coarrays.

Nicolas Koenig koenigni@gcc.gnu.org
Sun Oct 25 10:38:15 GMT 2020


https://gcc.gnu.org/g:9dca1f29608df4bda70b33be735373ac18b8714b

commit 9dca1f29608df4bda70b33be735373ac18b8714b
Author: Nicolas KÃnig <koenigni@student.ethz.ch>
Date:   Sun Oct 25 11:36:08 2020 +0100

    Check for correct type of ref before trying to handle coarrays.
    
    gcc/fortran/ChangeLog:
    
            PR native_coarray/97530
            * trans-array.c (gfc_conv_ss_descriptor): Check for correct type
            of ref before handling coarrays.

Diff:
---
 gcc/fortran/trans-array.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 55a63e359ae..261759d3e79 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3040,7 +3040,7 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
       /* If we have a native coarray with implied this_image (), add the
 	 appropriate offset to the data pointer.  */
       ref = ss_info->expr->ref;
-      if (flag_coarray == GFC_FCOARRAY_SHARED && ref
+      if (flag_coarray == GFC_FCOARRAY_SHARED && ref && ref->type == REF_ARRAY
 	  && ref->u.ar.dimen_type[ref->u.ar.dimen + ref->u.ar.codimen - 1]
 	     == DIMEN_THIS_IMAGE)
 	 tmp = gfc_native_coarray_add_this_image_offset (tmp, se.expr, &ref->u.ar, 1, 1);
@@ -3060,7 +3060,7 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
 	 offset for the codimensions.  */
       // TODO: check whether the recipient is a coarray, if it is, disable
       //	all of this
-      if (flag_coarray == GFC_FCOARRAY_SHARED && ref
+      if (flag_coarray == GFC_FCOARRAY_SHARED && ref && ref->type == REF_ARRAY
 	  && ref->u.ar.dimen_type[ref->u.ar.dimen + ref->u.ar.codimen - 1]
 		    == DIMEN_THIS_IMAGE)
 	tmp = gfc_add_strides (tmp, se.expr, ref->u.ar.as->rank,


More information about the Gcc-cvs mailing list