]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Check for correct type of ref before trying to handle coarrays.
authorNicolas KÃnig <koenigni@student.ethz.ch>
Sun, 25 Oct 2020 10:36:08 +0000 (11:36 +0100)
committerNicolas KÃnig <koenigni@student.ethz.ch>
Sun, 25 Oct 2020 10:36:44 +0000 (11:36 +0100)
gcc/fortran/ChangeLog:

PR native_coarray/97530
* trans-array.c (gfc_conv_ss_descriptor): Check for correct type
of ref before handling coarrays.

gcc/fortran/trans-array.c

index 55a63e359aefd6c009f520bd4050cfbfaf11eb53..261759d3e7940ddaf85b3508614d5fe30e82e5e9 100644 (file)
@@ -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,